shell 监控判断进程是否存在,如果不存在就重新启动脚本。

2015-03-20 0 863
shell 监控判断进程是否存在,如果不存在就重新启动脚本。
#!/bin/bash
while [ 1 ]
do
	SendMail_is_exstit=$(ps -ef | grep "feed SendMail" | grep -v grep | wc -l)
	if [ ${SendMail_is_exstit} == 0 ]
	then
		cd /var/www/sdkfeed/
                #要执行的脚本命令,我这里是跑redis队列发送邮件脚本
		./app/Console/cake SendMail
                 
	fi
	sleep 60
done

遇见资源网 shell shell 监控判断进程是否存在,如果不存在就重新启动脚本。 http://www.ox520.com/16892.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务