简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM