snapraid-btrfs-runner icon indicating copy to clipboard operation
snapraid-btrfs-runner copied to clipboard

How to check if runner is still running?

Open zilexa opened this issue 3 years ago • 1 comments

Hope you don't mind me asking another question.. Before using your script, my sync & cleanup commands were part of a nightly cleanup bash script, run via cron (non-root). It contained this:

# Create a temp file to indicate maintenance is running
touch /tmp/maintenance-is-running

(perform actions)
# Delete temp file, follow up tasks can continue
rm /tmp/maintenance-is-running

This way, my next nightly scheduled cronjob (bash script creating backups, requires root) runs about an hour later via root cron, but waits for that temporary file to be deleted. This way, I made sure snapraid was finished before performing other disk intensive duties:

# Make sure maintenance is finished before performing backups via btrbk
while [[ -f /tmp/maintenance-is-running ]] ; do
   sleep 10 ;
done

Now it seems silly to use a bash script to run your script, but now my root backup script can no longer detect if snapraid is running. Is there a way for me to simply figure out if your script is finished, before performing other tasks?

zilexa avatar Mar 26 '21 21:03 zilexa

Now it seems silly to use a bash script to run your script

I don't think that's silly at all. This script doesn't have a lock file or anything so if you need create that /tmp/maintenance-is-running, I think running a small wrapper script around snapraid-btrfs-runner is still elegant.

but now my root backup script can no longer detect if snapraid is running

How is it detecting it? Ultimately, snapraid-btrfs-runner calls snapraid-btrfs which calls snapraid to do the actual parity sync and scrub actions. It should look like native snapraid to any script looking for that process.

fmoledina avatar Mar 28 '21 02:03 fmoledina