How to prevent monit daemon stopped

monit

I use monit to make sure everything running fine, but monit daemon was also stopped.

I dont know how this be, and how to prevent monit daemon from stopped?

Best Answer

On Ubuntu 9.10, /etc/inittab does not exist, because Ubuntu uses upstart instead of /sbin/init. So to achieve the same thing as answer #1 above we need an upstart script:

# This is an event.d (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
#
# You can manually start and stop monit like this:
# 
# start monit
# stop monit
#
# Karim Ratib (http://thereisamoduleforthat.com)
# 
# Based on monit.upstart (https://code.google.com/p/monit/source/browse/trunk/contrib/monit.upstart?r=132)
# by Michael Hale (http://halethegeek.com)

start on runlevel [2345]
stop on runlevel [06]

exec /usr/sbin/monit -Ic /etc/monit/monitrc
respawn