mackam
mackam

Reputation: 21

Monit cannot start/stop service

Monit cannot start/stop service, If i stop the service, just stop monitoring the service in Monit. Attached the log and config for reference.

    #Monitor vsftpd#
check process vsftpd
 matching vsftpd
 start program = "/usr/sbin/vsftpd start"
 stop program = "/usr/sbin/vsftpd stop"
if failed port 21 protocol ftp then restart

Upvotes: 2

Views: 1222

Answers (1)

boppy
boppy

Reputation: 1908

The log states: "stop on user request". The process is stopped and monitoring is disabled, since monitoring a stopped (= non existing) process makes no sense.

If you Restart service (by cli or web) it should print info: 'test' restart on user request to the log and call the stop program and continue with the start program (if no dedicated restart program is provided).

In fact one problem can arise: if the stop scripts fails to create the expected state (=NOT(check process matching vsftpd)), the start program is not called. So if there is a task running that matches vsftpd, monit will not call the start program. So it's always better to use a PID file for monitoring where possible.

Finally - and since not knowing what system/versions you are on, an assumption: The vsftpd binary on my system is really only the daemon. It is not supporting any options. All arguments are configuration files as stated in the man page. So supplying start and stop only tries to create new daemons loading start and stop file. -- If this is true, the one problem described above applies, since your vsftpd is never stopped.

Upvotes: 0

Related Questions