Skip to content

Instantly share code, notes, and snippets.

@gfreezy
Created June 17, 2013 08:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gfreezy/5795499 to your computer and use it in GitHub Desktop.
Save gfreezy/5795499 to your computer and use it in GitHub Desktop.
run only one process a time. if_not_runnig && cmd
#!/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