我对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.
这只是您应该执行程序或脚本的示例:
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'"