Subversion Repositories configs

Rev

Rev 3 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#! /bin/sh
2
#
3
# apcupsd      This shell script takes care of starting and stopping
4
#	       the apcupsd UPS monitoring daemon.
5
#
6
# chkconfig: - 60 99
7
# description: apcupsd monitors power and takes action if necessary
8
#
9
### BEGIN INIT INFO
10
# Provides: apcupsd
11
# Required-Start: $syslog $local_fs
12
# Required-Stop: $syslog $local_fs
13
# Default-Start:
14
# Default-Stop: 0 1 6
15
# Short-Description: apcupsd daemon
16
# Description: APC UPS Power Control Daemon for Linux
17
### END INIT INFO
18
 
19
APCPID=/var/run/apcupsd.pid
20
 
21
# Source function libarary
22
. /etc/rc.d/init.d/functions
23
 
24
case "$1" in
25
    start)
26
       rm -f /etc/apcupsd/powerfail
16 - 27
       grep -s -q 'POWER FAILURE' /etc/nologin && rm -f /etc/nologin
3 - 28
       echo -n "Starting UPS monitoring:"
29
       daemon /sbin/apcupsd -f /etc/apcupsd/apcupsd.conf
30
       RETVAL=$?
31
       echo
32
       [ $RETVAL -eq 0 ] && touch /var/lock/subsys/apcupsd
33
       ;;
34
    stop)
35
       echo -n "Shutting down UPS monitoring:"
36
       killproc apcupsd
37
       echo
38
       rm -f $APCPID
39
       rm -f /var/lock/subsys/apcupsd
40
       ;;
41
    restart|force-reload)
42
       $0 stop
43
       $0 start
44
       ;;
45
    condrestart)
46
       [ -f /var/lock/subsys/apcupsd ] && $0 restart || :
47
       ;;
48
    reload)
49
       echo "$0: reload not implemented"
50
       exit 3
51
       ;;
52
    status)
53
       status apcupsd
54
       RETVAL=$?
55
       if [ $RETVAL -eq 0 ]
56
       then
57
          /sbin/apcaccess status
58
       else
59
          exit $RETVAL
60
       fi
61
       ;;
62
    *)
63
       echo "Usage: $0 {start|stop|restart|condrestart|status}"
64
       exit 1
65
       ;;
66
esac
67
exit 0