Created
October 14, 2011 14:31
-
-
Save xurenlu/1287279 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 | |
# check daemon | |
check(){ | |
cmd=$1 | |
lines=`ps -ef | grep $cmd |grep -v grep |wc -l` | |
# if not found - equals to 1, start it | |
echo $lines | |
if [ $? -eq 0 ]; then | |
$cmd | |
else | |
echo "eq 0 - daemon found - do nothing" | |
fi | |
} | |
help(){ | |
echo "" $0 " YOUR_COMMAND " | |
} | |
the_cmd="testing.php" | |
if [ -z $the_cmd ]; then | |
help | |
else | |
check $the_cmd | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment