#!/bin/sh
#
# Copyright (c) 1995-2002 SuSE Linux AG, Nuernberg, Germany.
# All rights reserved.
#
# LSB compliant service control script; see http://www.linuxbase.org/spec
#
#
### BEGIN INIT INFO
# Provides:                   moomps
# Required-Start:             $remote_fs $syslog sendmail
# Required-Stop:              $remote_fs $syslog sendmail
# X-UnitedLinux-Should-Start: $time
# X-UnitedLinux-Should-Stop:  $time
# Default-Start:              3 5
# Default-Stop:               0 1 2 6
# Description:                Start the moomps system monitoring daemon.
### END INIT INFO

PROGRAM=/usr/sbin/moomps
test -x $PROGRAM || exit 5
. /etc/rc.status
. /etc/sysconfig/moomps

rc_reset

case "$1" in
    start)
        echo -n "Starting moomps "
        startproc -u $MOOMPS_USER $PROGRAM -f /etc/moomps
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down moomps"
        killproc -QUIT $PROGRAM
        rc_status -v
        ;;
    try-restart)
        ## Do a restart only if the service was active before.
        ## Note: try-restart is not (yet) part of LSB (as of 1.2)
        $0 status >/dev/null &&  $0 restart

        # Remember status and be quiet
        rc_status
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    force-reload)
        $0 stop
        $0 start
        rc_status
        ;;
    reload)
        rc_failed 3
        rc_status -v
	;;
    status)
        echo -n "Checking for service moomps "
        checkproc $PROGRAM
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status|force-reload}"
        exit 1
esac
rc_exit
