linux查看进程是否存在,不存在则重启

 

ps -ef | grep 程序名| grep -v grep  | wc -l

 

cd $(dirname $0)

source ~/.bash_profile


count=`ps -ef | grep "nginx: master process" | grep -v grep | wc -l`


if [ $count -eq 0 ];then
        /data/openresty/nginx/sbin/nginx
fi

 

你可能感兴趣的:(linux)