Snapper is a simple python script that executes SnapRAID in order to sync and scrub the array. Inspired by the great snapraid-aio-script with a limited feature set.
The reason I created this is that I wanted more granular control of how my setup worked, which consequently means, this script is opinionated.
- Sanity checks the array
- Runs
touch
if necessary - Runs
diff
before attempting tosync
- Allows you to pre-hash before syncing
- Allows you to automatically re-run
sync
if snapraid recommends it - Allows you to run snapraid with a lower priority to keep server and drives responsive
- Allows you to abort execution if configurable thresholds are broken
- Allows you to
scrub
aftersync
- Allows delay of
scrub
job to every N invocations - Logs the raw snapraid output as well as formatted text
- Creates a nicely formatted report and sends it via email or discord
- Provides live insight into the sync/scrub process in Discord
- Spin down selected hard drives after script completion
This project is a work in progress, and can change at any time.
I welcome bugfixes and contributions, but be aware that I will not merge PRs that I do not feel do not fit the usage of this tool.
- SnapRAID 12.2 or later
- Python 3.7 or later
- Install the necessary dependencies by running
pip3 install -r requirements.txt
- Download the latest release of this project, or clone the git project.
- Copy or rename
config.json.example
toconfig.json
- Run the script via
python3 snapper.py
You may run the script with the --force
flag to force a sync/scrub and ignore any thresholds or sanity checks.
A config.json
file is required and expected to be in the same root as this script.
Please read through the json schema to understand the exact details of each property. If you're not fluent in json schema (I don't blame you), you could use something like this to get a better idea of the different options.