monit被系统杀死后自动重启
Restart monit automatically after it has been killed by the system
我正在使用 monit 来监控我的 WEB 服务。一切正常,直到 monit 进程被系统杀死。监控日志文件的一部分显示了该问题
为了让 monit 在启动时自动启动并在失败时重新启动,我为 monit 添加了 upstart 配置(我是 运行 Ubuntu 14.04),看起来像这样:
# This is an upstart script to keep monit running.
# To install disable the old way of doing things:
#
# /etc/init.d/monit stop && update-rc.d -f monit remove
#
# then put this script here:
#
# /etc/init/monit.conf
#
# and reload upstart configuration:
#
# initctl reload-configuration
#
# You can manually start and stop monit like this:
#
# start monit
# stop monit
#
description "Monit service manager"
limit core unlimited unlimited
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
expect daemon
respawn
exec /usr/bin/monit -c /etc/monitrc
pre-stop exec /usr/bin/monit -c /etc/monitrc quit
当我重新启动系统时,monit 不是 运行。
sudo monit status
$ monit: Status not available -- the monit daemon is not running
如何配置 upstart 以保持监控 运行 和监控?
我在 start monit 命令中的配置文件路径错误。正确的命令是
exec /usr/bin/monit -c /etc/monit/monitrc
pre-stop exec /usr/bin/monit -c /etc/monit/monitrc quit
它将 monit 作为守护进程启动,并在我杀死它时重新启动:
ps aux | grep monit
root 2173 0.0 0.1 104348 1332 ? Sl 04:13 0:00 /usr/bin/monit -c /etc/monit/monitrc
sudo kill -9 2173
ps aux | grep monit
root 2184 0.0 0.1 104348 1380 ? Sl 04:13 0:00 /usr/bin/monit -c /etc/monit/monitrc
我正在使用 monit 来监控我的 WEB 服务。一切正常,直到 monit 进程被系统杀死。监控日志文件的一部分显示了该问题
为了让 monit 在启动时自动启动并在失败时重新启动,我为 monit 添加了 upstart 配置(我是 运行 Ubuntu 14.04),看起来像这样:
# This is an upstart script to keep monit running.
# To install disable the old way of doing things:
#
# /etc/init.d/monit stop && update-rc.d -f monit remove
#
# then put this script here:
#
# /etc/init/monit.conf
#
# and reload upstart configuration:
#
# initctl reload-configuration
#
# You can manually start and stop monit like this:
#
# start monit
# stop monit
#
description "Monit service manager"
limit core unlimited unlimited
start on runlevel [2345]
stop on starting rc RUNLEVEL=[016]
expect daemon
respawn
exec /usr/bin/monit -c /etc/monitrc
pre-stop exec /usr/bin/monit -c /etc/monitrc quit
当我重新启动系统时,monit 不是 运行。
sudo monit status
$ monit: Status not available -- the monit daemon is not running
如何配置 upstart 以保持监控 运行 和监控?
我在 start monit 命令中的配置文件路径错误。正确的命令是
exec /usr/bin/monit -c /etc/monit/monitrc
pre-stop exec /usr/bin/monit -c /etc/monit/monitrc quit
它将 monit 作为守护进程启动,并在我杀死它时重新启动:
ps aux | grep monit
root 2173 0.0 0.1 104348 1332 ? Sl 04:13 0:00 /usr/bin/monit -c /etc/monit/monitrc
sudo kill -9 2173
ps aux | grep monit
root 2184 0.0 0.1 104348 1380 ? Sl 04:13 0:00 /usr/bin/monit -c /etc/monit/monitrc