Monit fails to start process

monitmonitoring

Monit fails to start a Java process that is launched from an init script in /etc/init.d. The init script works when launched from the shell. Monit detects that the service is running and detects when the service is down.

Error message from /var/log/monit:

[UTC Aug 17 22:48:37] info     : 'fanpoint-service' start: /etc/init.d/java-service
[UTC Aug 17 22:49:07] error    : 'fanpoint-service' failed to start (exit status -1) -- no output


$monit -vv status fanpoint-service
...
Process 'fanpoint-service'
  status                            Execution failed
  monitoring status                 Monitored
  data collected                    Wed, 17 Aug 2016

Best Answer

Fixed.

This doesn't work start program = "/etc/init.d/java-service start"

This did work start program = "/bin/bash -c '/etc/init.d/java-service start'"

Monit Documentation. https://mmonit.com/wiki/Monit/FAQ#execution