UPS: apcupsd clean sources
[tomato.git] / release / src / router / apcupsd / platforms / sun / apcupsd.in
blobd007ff6e5c9154d869bfb9d3a8d2553c2d0dca7a
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 # Update October 7th, 2001 - CPE
11 APCPID=@PIDDIR@/apcupsd.pid
12 DISTVER="@DISTVER@"
13 POWERFAILDIR=@PWRFAILDIR@
14 LOCKDIR=@LOCKDIR@
15 SBINDIR=@sbindir@
17 return=" Done."
20 case "$1" in
21 start)
22 rm -f ${POWERFAILDIR}/powerfail
23 echo "Starting apcupsd power management ...\c"
24 ${SBINDIR}/apcupsd || return=" Failed."
25 touch ${LOCKDIR}/apcupsd
26 echo "$return"
28 stop)
29 echo "Stopping apcupsd power management ...\c"
30 if [ -f ${APCPID} ]; then
31 THEPID=`cat ${APCPID}`
32 kill ${THEPID} || return=" Failed."
33 rm -f ${APCPID}
34 else
35 return=" Failed."
37 rm -f ${LOCKDIR}/apcupsd
38 echo "$return"
40 restart)
41 $0 stop
42 $0 start
44 status)
45 ${SBINDIR}/apcaccess status
48 echo "Usage: $0 {start|stop|restart|status}"
49 exit 1
50 esac
52 exit 0