GlenNicholls / unraid_parity_scripter

Unraid user script that supports specifying Python functions to call during parity check start/stop stages
MIT License
0 stars 0 forks source link

Unraid Parity Scripter

Unraid user script that supports specifying Python functions to call during parity check start/stop stages

Usage

After downloading the Parity Check Tuning, user scripts, and Python plugins, this repo can be cloned to a desirable location. The following is an example for how I use the script:

#!/bin/bash
echo "Removing stale versions of the app and installing clean"
rm -f parity_scripter.pyz
wget https://github.com/GlenNicholls/unraid_parity_scripter/releases/download/latest/parity_scripter.pyz
chmod +x parity_scripter.pyz

cat >config.json <<EOL
{
    "containers": [
        "duplicacy",
        "postgres"
    ]
}
EOL

# Noticed that when running script in background and aborting it, the process still ran
# which led to weird behavior where bug fixes appeared not to work because notifications
# and such were showing info from old versions
echo "Killing any existing stale apps"
pgrep -a -f parity_scripter
pkill -e -f parity_scripter

echo "Starting app"
./parity_scripter.pyz -c config.json -s 300

Where -c is the config file path and -s is the sleep/check interval. An example config.json looks like the following:

{
    "containers": ["<container 1>", ..., "<container n>"]
}

The containers variable is a list of the Docker container names (as defined in the Docker tab) to start/stop based on the state of the Parity Check status. The above containers, for example, will all be stopped in the specified order when parity is started and killed in the same order when parity check is stopped or resumed.

My use-case is that I am only allowing parity check to occur during off-hours and I need certain containers to be stopped so they aren't saturating IO bandwidth. I.e. when parity starts, I disable certain containers to minimize the time to complete the parity check and then re-enable the containers when the parity check is paused or not running (e.g. outside allowed parity check hours).

Disclaimers