Created
August 31, 2015 07:33
-
-
Save merevu/c8cdf6c21defe8710fe9 to your computer and use it in GitHub Desktop.
bash script :: avoid self-process dup-running
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 | |
if [[ "`pidof -x $(basename $0) -o %PPID`" ]]; then | |
echo "This script is already running with PID `pidof -x $(basename $0) -o %PPID`" | |
exit | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment