Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 2a66bc14d5bd0b623a57416d34b8a746 > files > 2

freeipmi-bmc-watchdog-1.0.5-1.fc16.i686.rpm

#!/bin/sh
#
# chkconfig: - 99 01
# description: bmc-watchdog startup script
#
### BEGIN INIT INFO
# Provides: bmc-watchdog
# Required-Start: $network $remote_fs $syslog
# Required-Stop:  $network $remote_fs $syslog
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
# Short-Description: Start and stop bmc-watchdog
# Description: BMC watchdog timer daemon
### END INIT INFO

DAEMON=/usr/sbin/bmc-watchdog
PIDFILE=/var/run/bmc-watchdog.pid
LOCKFILE=/var/lock/subsys/bmc-watchdog
CONFFILE=/etc/sysconfig/bmc-watchdog

[ -f $DAEMON ] || exit 5

if [ -r $CONFFILE ]; then
        . $CONFFILE
fi

# Load Redhat or Suse appropriate libs
if [ -f /etc/rc.d/init.d/functions ] ; then
    . /etc/rc.d/init.d/functions
    Xstart() {

        # Default deamon mode
        #
        # timer use = SMS/OS
        # pre-timeout interrupt = none
        # action = reset
        # -F, -P, -L, -S, -O - clear flags
        # initial-countdown = 900 seconds (15 mins)
        # reset-period = 60 seconds

        daemon -20 $DAEMON $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch $LOCKFILE
    }
    Xstop() {
        killproc bmc-watchdog
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
    }
    Xstatus() {
        status bmc-watchdog
        RETVAL=$?
        return $RETVAL
    }
    Xcondrestart() {
        if test -e $LOCKFILE; then
            $0 stop
            $0 start
            RETVAL=$?
        fi
    }
    Xexit() {
        exit $RETVAL
    }
elif [ -f /etc/rc.status ] ; then
    . /etc/rc.status
    Xstart() {
        startproc -20 $DAEMON $OPTIONS
        rc_status -v
        RETVAL=$?
        return $RETVAL
    }
    Xstop() {
        killproc -TERM $DAEMON
        rc_status -v
        RETVAL=$?
        return $RETVAL
    }
    Xstatus() {
        echo -n "Checking for bmc-watchdog: "
        checkproc $DAEMON
        rc_status -v
        RETVAL=$?
        return $RETVAL
    }
    Xcondrestart() {
        $0 status
        if test $? = 0; then
            $0 restart
        else
            rc_reset
        fi
        rc_status
        RETVAL=$?
        return $RETVAL
    }
    Xexit() {
        rc_exit
    }
else
    echo "Unknown distribution type"
    exit 1
fi

RETVAL=0

case "$1" in
   start)
        echo -n "Starting bmc-watchdog: "
        Xstatus >/dev/null 2>&1 && exit 0
        Xstart
        ;;

  stop)
        echo -n "Shutting down bmc-watchdog: "
        Xstop
        ;;

  restart)
        $0 stop
        $0 start
        RETVAL=$?
        ;;
  status)
        Xstatus
        ;;
  condrestart|try-restart|force-reload)
        Xcondrestart
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status|condrestart|try-restart|force-reload}"
        exit 2
esac

exit $RETVAL