#! /bin/sh # # apcupsd This shell script takes care of starting and stopping # the apcupsd UPS monitoring daemon. # # chkconfig: 2345 20 99 # description: apcupsd monitors power and takes action if necessary # APCPID=@PIDDIR@/apcupsd.pid DISTVER="@DISTVER@" return=" Done." case "$1" in start) rm -f @PWRFAILDIR@/powerfail rm -f @nologdir@/nologin echo -n "Starting apcupsd power management" @sbindir@/apcupsd || return=" Failed." touch @LOCKDIR@/subsys/apcupsd echo -e "$return" ;; stop) echo -n "Stopping apcupsd power management" if [ -f ${APCPID} ]; then THEPID=`cat ${APCPID}` kill ${THEPID} || return=" Failed." rm -f ${APCPID} else return=" Failed." fi rm -f @LOCKDIR@/subsys/apcupsd echo -e "$return" ;; restart) $0 stop $0 start ;; status) @sbindir@/apcaccess status ;; *) echo "Usage: $0 {start|stop|restart|status}" exit 1 esac exit 0