shell脚本判断是否有某进程在运行

995阅读 0评论2010-08-08 bailiangcn
分类:LINUX

#!/bin/sh
SERVICE='httpd'
 
if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
    echo "$SERVICE service running, everything is fine"
else
    echo "$SERVICE is not running"
    echo "$SERVICE is not running!" | mail -s "$SERVICE down" root
fi
 


上一篇:五大Linux简单命令 帮你解决性能问题
下一篇:Swap分区技巧两则