UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / slackware / apcupsd.in
blob4335f3742905a3aac9e0a34fd488e2eff4a92403
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 DISTVER="@DISTVER@"
12 return=" Done."
15 case "$1" in
16 start)
17 rm -f @PWRFAILDIR@/powerfail
18 rm -f @nologdir@/nologin
19 echo -n "Starting apcupsd power management.."
20 if [ -f ${APCPID} ]; then
21 return=" Already running."
22 else
23 @sbindir@/apcupsd && touch @LOCKDIR@/subsys/apcupsd \
24 || return=" Failed."
27 echo -e "$return"
29 stop)
30 echo -n "Stopping apcupsd power management.."
31 if [ -f ${APCPID} ]; then
32 THEPID=`cat ${APCPID}`
33 kill ${THEPID} || return=" Failed."
34 rm -f ${APCPID}
35 else
36 return=" Nothing to stop."
38 rm -f @LOCKDIR@/subsys/apcupsd
39 echo -e "$return"
41 restart)
42 $0 stop
43 $0 start
45 status)
46 @sbindir@/apcaccess status
49 echo "Usage: $0 {start|stop|restart|status}"
50 exit 1
51 esac
53 exit 0