加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

linux – Monit重启程序脚本

发布时间:2020-12-13 18:48:50 所属栏目:Linux 来源:网络整理
导读:我对monit相当新,我想知道这个脚本是否足以重启崩溃的程序让我们说program1是程序的名称. check process program1matching "program1"start program = "/home/user/files/start.sh"stop program = "/home/user/files/stop.sh" 它现在会重启一个崩溃的程序吗
我对monit相当新,我想知道这个脚本是否足以重启崩溃的程序让我们说program1是程序的名称.
check process program1
matching "program1"
start program = "/home/user/files/start.sh"
stop program = "/home/user/files/stop.sh"

它现在会重启一个崩溃的程序吗?我怎样才能保证它在工作时不重启程序?

编辑:
更多信息
该程序使用端口30000 udp.这会让它更加谨慎吗? “周期”之间有多少秒?

if failed port 30000 type UDP for 3 cycles then restart

解决方法

Monit uses the system call execv to execute a program or a script.
This means that you cannot write shell commands directly in the start,
stop or exec statements. To do this,you must do as above; start a
shell and issue your commands there.

Read about execution

这只是您应该执行程序或脚本的示例:

check process program1
matching "program1"
start program = "/bin/bash -c '/home/user/files/start.sh'"
stop program = "/bin/bash -c  '/home/user/files/stop.sh'"

基于ConfigurationExamples

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读