Created
June 17, 2013 08:41
-
-
Save gfreezy/5795499 to your computer and use it in GitHub Desktop.
run only one process a time.
if_not_runnig && cmd
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
#!/usr/bin/env bash | |
# exit when no parameter provided | |
test -z "$*" && exit 0 | |
id=`echo "$*" | md5sum | cut -d " " -f 1` | |
idfile="/tmp/$id" | |
if [ ! -e $idfile ]; then | |
touch $idfile | |
$@ | |
rm $idfile | |
exit -1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment