Last active
June 7, 2016 09:12
-
-
Save petitchevalroux/8fbcb1198ef1af425a08ce225c3992ab to your computer and use it in GitHub Desktop.
lock running script
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
#!/bin/bash | |
lockdir='/tmp/my.lock' | |
if ! mkdir "${lockdir}" &>/dev/null ; then | |
echo "Lock failed - exit" >&2 | |
exit 1 | |
fi | |
rm -rf "${lockdir}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment