shell脚本监控进程
发布时间:2020-12-15 09:16:55 所属栏目:安全 来源:网络整理
导读:直接以实例示范如何使用shell脚本实现对待监测进程的监测: 背景: 服务器需要确保sendFlowMail.py脚本的运行。 思路: 故编写一个shell脚本,按周期(60秒)判断该进程是否在运行,若未运行则确保其运行。 #!/bin/shPWD=`pwd`while true;do ps -fe|grep sendF
直接以实例示范如何使用shell脚本实现对待监测进程的监测: 背景: 服务器需要确保sendFlowMail.py脚本的运行。 思路: 故编写一个shell脚本,按周期(60秒)判断该进程是否在运行,若未运行则确保其运行。 #!/bin/sh PWD=`pwd` while true;do ps -fe|grep sendFlowMail.py |grep -v grep if [ $? -ne 0 ] then echo "start process....." cd /opt/sendFlowInfo/ python sendFlowMail.py cd ${PWD} else echo "sendFlowMail.py is running....." fi sleep 60 done ##### (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- Bootstrap下拉菜单效果实例代码分享
- Angular 2到4升级,从Http转移到HttpClient
- angularjs – typeahead angular ui – 无法读取undefined的
- 浅谈WebService
- AngularJs广播重复执行太多次
- Getting Started with AngularJS 1.5 and ES6: part 3
- Scala - 08 - 函数式编程:高阶函数
- 异常——JAXB 2.0 API is being loaded from the bootstrap
- Emacs实用Tips【持续更新】
- AngularJS – 如何在ng-Repeat中引用属性名称