Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to check if runner is still running? #5

Open
zilexa opened this issue Mar 26, 2021 · 1 comment
Open

How to check if runner is still running? #5

zilexa opened this issue Mar 26, 2021 · 1 comment

Comments

@zilexa
Copy link

zilexa commented Mar 26, 2021

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?

@fmoledina
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants