Last active
August 29, 2015 13:57
-
-
Save pahud/9825419 to your computer and use it in GitHub Desktop.
execute cron job with flock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MAILTO='your@gmail.com' | |
# my cronjob | |
MP_UPD_LOCK='/tmp/.your_lock_file.lock' | |
* * * * * pahud /usr/bin/flock -w1 ${MP_UPD_LOCK} /usr/bin/python -c "from xxxx import foo as f; f.FooBar().update()" > /dev/null || SUBJ="[ERROR] flock on ${MP_UPD_LOCK} failed"; mail -s "${SUBJ}" "${MAILTO}" > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment