UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / netbsd / apcupsd.in
blob378cc9f3ca0ebd78228e33a2cfbc361a783328f2
1 #! /bin/sh
3 # apcupsd This shell script takes care of starting and stopping
4 # the apcupsd UPS monitoring daemon.
6 # chkconfig: 2345 20 99
7 # description: apcupsd monitors power and takes action if necessary
9 APCPID=@PIDDIR@/apcupsd.pid
10 APCLOCK=@PIDDIR@/apcupsd.lock
11 DISTVER="@DISTVER@"
13 return=" Done."
16 case "$1" in
17 start)
18 rm -f @PWRFAILDIR@/powerfail
19 rm -f @nologdir@/nologin
20 echo -n "Starting apcupsd power management"
21 @sbindir@/apcupsd --kill-on-powerfail || return=" Failed."
22 touch $APCLOCK
23 echo -e "$return"
25 stop)
26 echo -n "Stopping apcupsd power management"
27 if [ -f ${APCPID} ]; then
28 THEPID=`cat ${APCPID}`
29 kill ${THEPID} || return=" Failed."
30 rm -f ${APCPID}
31 else
32 return=" Failed."
34 rm -f $APCLOCK
35 echo -e "$return"
37 restart)
38 $0 stop
39 $0 start
41 status)
42 @sbindir@/apcaccess status
45 echo "Usage: $0 {start|stop|restart|status}"
46 exit 1
47 esac
49 exit 0