#!/bin/sh # # monit Monitoring daemon # # chkconfig: 345 99 1 # description: Monitoring daemon # # Source function library . /etc/rc.d/init.d/functions # Get service config [ -f /etc/sysconfig/monit ] && . /etc/sysconfig/monit RETVAL=0 # See how we were called. case "$1" in start) # Check if the service is already running? if [ ! -f /var/lock/subsys/monit ]; then msg_starting monit daemon monit -c /etc/monitrc -l syslog -d 60 RETVAL=$? [ $RETVAL -eq 0 ] && touch /var/lock/subsys/monit else msg_already_running monit fi ;; stop) # Stop daemons. if [ -f /var/lock/subsys/monit ]; then msg_stopping monit killproc monit rm -f /var/lock/subsys/monit > /dev/null 2>&1 else msg_not_running monit fi ;; status) status monit monit -c /etc/monitrc status exit $? ;; restart) $0 stop $0 start exit $? ;; reload|force-reload) if [ -f /var/lock/subsys/monit ]; then msg_reloading monit killproc monit -HUP RETVAL=$? else msg_not_running monit >&2 exit 7 fi ;; *) msg_usage "$0 {start|stop|restart|reload|force-reload|status}" exit 3 esac exit $RETVAL