简体   繁体   English

Monit无法启动/停止服务

[英]Monit cannot start/stop service

Monit cannot start/stop service, If i stop the service, just stop monitoring the service in Monit. Monit无法启动/停止服务,如果我停止了该服务,只需停止监视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). 如果您通过cli或web 重新启动服务 ,则应打印以下info: 'test' restart on user request到日志,并调用停止程序并继续启动程序(如果未提供专用的重新启动程序)。

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. 实际上,可能会出现一个问题:如果停止脚本未能创建期望的状态(= NOT(check process matching vsftpd) ),则不会调用启动程序。 So if there is a task running that matches vsftpd , monit will not call the start program. 因此,如果正在运行与vsftpd匹配的任务,monit将不会调用启动程序。 So it's always better to use a PID file for monitoring where possible. 因此,最好在可能的情况下使用PID文件进行监视。

Finally - and since not knowing what system/versions you are on, an assumption: The vsftpd binary on my system is really only the daemon. 最后-由于不知道您使用的是哪个系统/版​​本,因此有一个假设:我系统上的vsftpd二进制文件实际上只是守护程序。 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. 因此,提供启动和停止操作仅尝试创建新的守护程序来加载startstop文件。 -- If this is true, the one problem described above applies, since your vsftpd is never stopped. -如果是这样,则上述问题将适用,因为您的vsftpd永不停止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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