Last active
February 8, 2016 15:47
-
-
Save arj03/8b8cbbcd4fea812e25ae to your computer and use it in GitHub Desktop.
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 [ $# -eq 0 ]; then | |
echo "\nUsage start-unless-running.sh process-name path-to-script\n" | |
exit 1 | |
fi | |
ps aax | grep $1 | grep -v grep | grep -v start-unless-running.sh > /dev/null | |
if [ $? -eq 0 ]; then | |
echo "Process is running." | |
else | |
echo "Process is not running. Starting" | |
$2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment