Created
June 27, 2011 02:08
-
-
Save auxesis/1048206 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # flock -e -w 0 200 - setup an exclusive lock around every command to be executed (we use fd 200). | |
| # wait indefinitely until the lock is released before doing anything. | |
| set -e | |
| ( | |
| flock -e -w 0 200 | |
| # Put your commands here. | |
| ) 200>/tmp/cron.flock-$(basename $0) | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment