用shell脚本监控进程是否存在 不存在则启动的实例

用shell脚本监控进程是否存在 不存在则启动的实例:

#!/bin/sh
ps -fe|grep processString |grep -v grep
if [ $? -ne 0 ]
then
echo "start process....."

nohup php yii test/action &

else
echo "runing....."
fi
#####
processString 表示进程特征字符串,能够查询到唯一进程的特征字符串
0表示存在的
$? -ne 0 不存在,$? -eq 0 存在

posted on 2018-10-31 08:27  dongruiha  阅读(144)  评论(0编辑  收藏  举报

导航