Search code examples
ubuntutomcatservermonit

Monit dont work because cant find "if" program


Im trying to configure monit on my ubuntu server for tomcat, but when I execute:

monit reload

It throws an error:

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

I dont know why it happends.

I added my configuration at the end of the file :

/etc/monit/monitrc

And this is my configuration code:

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/*

What am I doing wrong? Why throws this error?

Thanks!


Solution

  • you simply have one double quote too much at stop program.

    It should be:

    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/*