Monit 不起作用,因为找不到"if"程序



我试图在我的 ubuntu 服务器上为 tomcat 配置 monit,但是当我执行时:

monit reload

它抛出一个错误:

/etc/monit/monitrc:292: Program does not exist: 'if'

我不知道为什么会这样。

我在文件末尾添加了我的配置:

/etc/monit/monitrc

这是我的配置代码:

check process tomcat7 with pidfile "/usr/local/tomcat/tomcat.pid"
start program = "/etc/init.d/tomcat start"
stop program = " "/etc/init.d/tomcat stop"
if failed port 8080 for 5 cycles then restart
include /etc/monit/conf.d/*
include /etc/monit/conf-enabled/*

我做错了什么?为什么抛出此错误?

谢谢!

你只是在stop program处有一个双引号太多了。

它应该是:

check process tomcat7 with pidfile "/usr/local/tomcat/tomcat.pid"
start program = "/etc/init.d/tomcat start"
stop program = "/etc/init.d/tomcat stop"
if failed port 8080 for 5 cycles then restart
include /etc/monit/conf.d/*
include /etc/monit/conf-enabled/*

最新更新