svc="sendmail"
if ps -ef | grep $svc | egrep -v grep >/dev/null
then
echo "$svc is started!"
else
echo "$svc not found!"
fi
-
ps -ef : 显示当前所有在运行的进程
-
|:管道,即其前面命令的的输出,作为后面命令的输入
-
grep service_name : 在输出信息中,查找service_name数据行
-
egrep -v grep: 不显示grep查找命令本身
810

被折叠的 条评论
为什么被折叠?



