Created
February 1, 2011 21:59
-
-
Save avleen/806782 to your computer and use it in GitHub Desktop.
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
LOCK=/tmp/shardbackup.lock | |
if [ -f $LOCK ]; then | |
ps -p `cat $LOCK` > /dev/null | |
if [ $? -eq 1 ]; then | |
# Stale lock file | |
rm $LOCK | |
else | |
echo "Lock file found for running process" | |
exit 1 | |
fi | |
fi | |
# Create the lockfile | |
echo $$ > $LOCK |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment