Skip to content

Instantly share code, notes, and snippets.

@petitchevalroux
Last active June 7, 2016 09:12
Show Gist options
  • Save petitchevalroux/8fbcb1198ef1af425a08ce225c3992ab to your computer and use it in GitHub Desktop.
Save petitchevalroux/8fbcb1198ef1af425a08ce225c3992ab to your computer and use it in GitHub Desktop.
lock running script
#!/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