]> git.pld-linux.org Git - packages/apcupsd.git/blame - apcupsd.init
- updated to 3.10.15
[packages/apcupsd.git] / apcupsd.init
CommitLineData
f39891c4
AA
1#! /bin/sh
2#
e5732d56 3# apcupsd This shell script takes care of starting and stopping
4# the apcupsd UPS monitoring daemon.
f39891c4 5#
e5732d56 6# chkconfig: 2345 60 99
7# description: apcupsd monitors power and takes action if necessary
f39891c4
AA
8
9# Source function library
10. /etc/rc.d/init.d/functions
11
12# Get network config
13. /etc/sysconfig/network
14
15# Check that networking is up.
16if is_yes "${NETWORKING}"; then
17 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
18 msg_network_down "UPS monitoring"
19 exit 1
20 fi
21else
22 exit 0
23fi
24
25RETVAL=0
26# See how we were called.
27case "$1" in
28 start)
29 rm -f /etc/apcupsd/powerfail
30 # Check if the service is already running?
31 if [ ! -f /var/lock/subsys/apcupsd ]; then
32 show "Starting APC UPS monitoring"
33 daemon /usr/sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
34 RETVAL=$?
35 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd
36 else
37 msg_already_running "APC UPS monitoring"
38 fi
39 ;;
40 stop)
41 if [ -f /var/lock/subsys/apcupsd ]; then
42 msg_stopping "APC UPS monitoring"
43 killproc apcupsd
44 rm -f /var/lock/subsys/apcupsd
45 else
46 msg_not_running "APC UPS monitoring"
47 fi
48 ;;
d9cc3596 49 restart|force-reload)
f39891c4 50 $0 stop
e5732d56 51 $0 start
f39891c4
AA
52 ;;
53 powerdown)
54 if [ -f /etc/apcupsd/powerfail ]; then
55 show "Switching the power off"
56 /etc/apcupsd/apccontrol killpower
57 sleep 60
58 fail
59 fi
60 ;;
61 status)
62 /usr/sbin/apcaccess status
63 ;;
64 *)
d9cc3596 65 msg_usage "$0 {start|stop|restart|force-reload|status|powerdown}"
f39891c4
AA
66 exit 3
67esac
68
69exit $RETVAL
This page took 0.053866 seconds and 4 git commands to generate.