Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > be726ddf6c5758eb1cc8af6bb9ac4093 > files > 10

apcupsd-3.14.8-1.fc13.i686.rpm

#! /bin/sh
#
# apcupsd      This shell script takes care of starting and stopping
#	       the apcupsd UPS monitoring daemon.
#
# chkconfig: - 60 99
# description: apcupsd monitors power and takes action if necessary
#
### BEGIN INIT INFO
# Provides: apcupsd
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Default-Start:
# Default-Stop: 0 1 6
# Short-Description: apcupsd daemon
# Description: APC UPS Power Control Daemon for Linux
### END INIT INFO

APCPID=/var/run/apcupsd.pid

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

case "$1" in
    start)
       rm -f /etc/apcupsd/powerfail
       rm -f /etc/nologin
       echo -n "Starting UPS monitoring:" 
       daemon /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
       RETVAL=$?
       echo
       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd
       ;;
    stop)
       echo -n "Shutting down UPS monitoring:"
       killproc apcupsd
       echo
       rm -f $APCPID
       rm -f /var/lock/subsys/apcupsd
       ;;
    restart|force-reload)
       $0 stop
       $0 start
       ;;
    condrestart)
       [ -f /var/lock/subsys/apcupsd ] && $0 restart || :
       ;;
    reload)
       echo "$0: reload not implemented"
       exit 3
       ;;
    status)
       status apcupsd
       RETVAL=$?
       if [ $RETVAL -eq 0 ]
       then
          /sbin/apcaccess status
       else
          exit $RETVAL
       fi
       ;;
    *)
       echo "Usage: $0 {start|stop|restart|condrestart|status}"
       exit 1
       ;;
esac
exit 0