Created
July 31, 2014 02:20
-
-
Save RobertWang/474f6622c846c373fdb0 to your computer and use it in GitHub Desktop.
[sh]判断一个进程是否启动
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
ps_check () { | |
psname="$1" | |
#pslist=`ps aux | grep $psname` | |
pscount=`ps aux | grep $psname | wc -l` | |
pscount=`expr $pscount` | |
if [ "$pscount" -gt 1 ] | |
then | |
echo $psname" is running ... [Success]" | |
else | |
echo $psname" is not run ... [Fail]" | |
fi | |
} | |
psname="nginx" | |
ps_check "nginx" | |
#ps_check $psname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment