【问题标题】:Monit dont work because cant find "if" programMonit 不工作,因为找不到“if”程序
【发布时间】:2020-03-19 06:22:30
【问题描述】:

我试图在我的 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/*

我做错了什么?为什么会抛出这个错误?

谢谢!

【问题讨论】:

    标签: ubuntu tomcat server monit


    【解决方案1】:

    你只是在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/*
    

    【讨论】:

    • 我很愚蠢 -.- 我已经用两天时间寻找 monit 的错误,只是这个。谢谢@boppy!
    猜你喜欢
    • 2021-09-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-27
    • 2014-09-06
    • 1970-01-01
    相关资源
    最近更新 更多