Created
November 24, 2016 23:30
-
-
Save lucien144/9ed86ff105d70f81745aec7687afa083 to your computer and use it in GitHub Desktop.
Atomic shell script for cronjobs
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/sh | |
# Author: http://serverfault.com/questions/191083/how-can-i-run-a-script-from-cron-only-once-at-a-time/639747 | |
LOCKDIR=/tmp/.myprog.lock | |
mkdir $LOCKDIR || exit 0 | |
trap "{ rm -rf $LOCKDIR ; exit 0; }" EXIT | |
echo "a" | |
sleep 30 | |
echo "b" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment