在shell中判断用户进程是否死掉

在shell中,有时要判断进程是否死掉,这个其实很好办,注意GREP的时候
过滤掉GREP本身的这个进程就可以了;
#!/bin/sh
SERVICE='httpd'

if ps ax | grep -v grep | grep $SERVICE > /dev/null
then
    echo "进程正在运行"
else
    echo "进程不在运行"
   fi

猜你喜欢

转载自jackyrong.iteye.com/blog/853904