linux – Monit重启程序脚本

前端之家收集整理的这篇文章主要介绍了linux – Monit重启程序脚本前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我对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

原文链接:https://www.f2er.com/linux/394564.html

猜你在找的Linux相关文章