UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / yellowdog / apcupsd.in
blobd1ac9ad8470ff88c744b07514a9a0589684d3748
1 #! /bin/sh
3 # apcupsd This shell script takes care of starting and stopping
4 # the apcupsd UPS monitoring daemon.
6 # chkconfig: 2345 60 99
7 # description: apcupsd monitors power and takes action if necessary
9 APCPID=@PIDDIR@/apcupsd.pid
11 DISTVER=`cat /etc/yellowdog-release | grep release | cut -f 5 -d ' '`
13 # Source function libarary
14 . /etc/rc.d/init.d/functions
16 case "$1" in
17 start)
18 rm -f @PWRFAILDIR@/powerfail
19 rm -f @nologdir@/nologin
20 echo -n "Starting UPS monitoring:"
21 daemon @sbindir@/apcupsd -f @sysconfdir@/apcupsd.conf
22 RETVAL=$?
23 echo
24 [ $RETVAL -eq 0 ] && touch @LOCKDIR@/subsys/apcupsd
26 stop)
27 echo -n "Shutting down UPS monitoring:"
28 killproc apcupsd
29 echo
30 rm -f $APCPID
31 rm -f @LOCKDIR@/subsys/apcupsd
33 restart)
34 $0 stop
35 sleep 15
36 $0 start
38 status)
39 @sbindir@/apcaccess status
42 echo "Usage: $0 {start|stop|restart|status}"
43 exit 1
45 esac
46 exit 0