700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > linux shell脚本监控进程崩溃自动重启

linux shell脚本监控进程崩溃自动重启

时间:2020-06-05 22:39:23

相关推荐

linux shell脚本监控进程崩溃自动重启

linux shell脚本监控进程崩溃自动重启,由于目前有Python实现的通讯组件时不时会异常中断,在还没有找到问题的解决办法时先暂时用shell监控并自动重启处理。

# ! /bin/shbasepath=$(cd `dirname $0`; pwd)while truedoprocnum=`ps -ef|grep "服务名称"|grep -v grep|wc -l`if [ $procnum -eq 0 ]then启动命令echo `date +%Y-%m-%d` `date +%H:%M:%S` "restart 服务" >>$basepath/shell.logfisleep 1done

后台执行 nohup ./shell.sh &

参考链接 :

linux shell脚本监控进程崩溃自动重启 : /lyb3290/article/details/80238641

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。