Sophie

Sophie

distrib > Mandriva > 2010.2 > x86_64 > by-pkgid > 310a96ceebd98baf2d666962f58ab95c > files > 3

monit-5.1.1-2mdv2010.1.x86_64.rpm

#! /bin/sh
### BEGIN INIT INFO
# Provides:          monit
# Should-Start:      $ALL
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: service and resource monitoring daemon
### END INIT INFO
#
# monit         Monitor Unix systems
#
# Author:	Clinton Work,   <work@scripty.com>
#
# chkconfig:    2345 98 02
# description:  Monit is a utility for managing and monitoring processes,
#               files, directories and devices on a Unix system. 
# processname:  monit
# pidfile:      /var/run/monit.pid
# config:       /etc/monitrc

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

MONIT=/usr/bin/monit

# Source monit configuration.
if [ -f /etc/sysconfig/monit ] ; then
        . /etc/sysconfig/monit
fi

[ -f $MONIT ] || exit 0

RETVAL=0

# See how we were called.
case "$1" in
  start)
        gprintf "Starting monit: "
        daemon $NICELEVEL $MONIT -d 120
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/monit
        ;;
  stop)
        gprintf "Stopping monit: "
        killproc monit
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/monit
        ;;
  restart)
  	$0 stop
	$0 start
	RETVAL=$?
	;;
  reload)
	gprintf "Reloading monit configuration: "
	killproc monit -HUP
	RETVAL=$?
	echo
	;;
  condrestart)
       [ -e /var/lock/subsys/monit ] && $0 restart
       ;;
  status)
        status monit
	RETVAL=$?
	;;
  *)
	gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0"
	exit 1
esac

exit $RETVAL