shell监视进程是否存在

来源:互联网 发布:慢走丝统盈编程 编辑:程序博客网 时间:2024/06/07 11:59

项目中发现magent进程莫名没有了,先写个shell脚本监控一下。有时间再查找原因。

#!/bin/sh


pid=`ps -ef | grep "magent" | grep "11113" | awk '{print $2}'`
if [ "$pid" == "" ];then
magent -u root -n 51200 -l 192.168.0.1 -p 11113 -s 192.168.0.2:11211 -s 192.168.0.3:11211 -b 192.168.0.1:11211
else
echo $pid > /dev/null
fi

原创粉丝点击