Monit似乎放弃重启服务,如果它失败几次,并取消监控它.我在文档中找不到有关何时或为何具体的细节.
我的Monit配置将设置如下:
set daemon 10 set logfile /var/log/monit.log set statefile /var/lib/monit/monit.state set alert foo@example.com not { nonexist,action,instance } include /etc/monit/conf.d/*
这是我使用的Monit规则集的一个例子:
check process myservice with pidfile /var/run/myservice/myservice.pid start program = "/home/myservice/current/start-myservice.sh" as uid myservice and gid myservice stop program = "/home/myservice/current/stop-myservice.sh" as uid myservice and gid myservice mode active
在我的环境中,我希望它能无限期地继续尝试它的轮询间隔.有没有办法配置monit永远不会停止监视服务,即使它没有成功启动?
解决方法
我只想使用一个cron作业,它将以所需的间隔运行monit start servicename.当然,您可以使用组进行更精细的控制.