]> git.pld-linux.org Git - packages/PowerChutePlus.git/blob - upsd.init
- use macros in %{pre,post}{,un}
[packages/PowerChutePlus.git] / upsd.init
1 #!/bin/sh
2
3 # Copyright 1999 American Power Conversion, All Rights Reserved
4 #
5 # Revision History:
6 #  msamson  01Apr99 For Linux, we have to remove upsoff.cmd, because we cannot 
7 #                   remove this file once all filesystems have been unmounted
8 #                   in our shutdown script. 
9 #  msamson  04Oct99 Incorporated standard init fixes from Redhat 
10 #                   (pjones@redhat.com)
11 #
12 # chkconfig: 2345 98 92
13 # description: Uninterruptable Power Supply Monitoring Daemon
14 #
15 #
16
17 # Source function library.
18 . /etc/rc.d/init.d/functions
19
20 # Source networking configuration.
21 . /etc/sysconfig/network
22
23 # Demon specified configuration.
24 [ -f /etc/sysconfig/upsd ] && . /etc/sysconfig/upsd
25
26 PWRCHUTE=/usr/lib/powerchute
27 export PWRCHUTE
28 TMPDIR=/tmp
29 export TMPDIR
30
31 if [ -r /upsoff.cmd ]; then
32         rm -f /upsoff.cmd
33 fi
34
35 # See how we were called.
36 case "$1" in
37   start)
38         # Check if the service is already running?
39         if [ ! -f /var/lock/subsys/upsd ]; then
40                 msg_starting UPSd
41                 cd $PWRCHUTE
42                 daemon upsd
43                 RETVAL=$?
44                 if [ $RETVAL -eq 0 ]; then
45                         touch /var/lock/subsys/upsd
46                 fi
47         else
48                 msg_Already_Running UPSd
49                 exit 1
50         fi
51         ;;
52   stop)
53         if [ -f /var/lock/subsys/upsd ]; then
54                 msg_stopping UPSd
55                 killproc upsd
56                 rm -f /var/lock/subsys/upsd >/dev/null 2>&1
57         else
58                 msg_Not_Running UPSd
59                 exit 1
60         fi      
61         ;;
62   status)
63         status upsd
64         ;;
65   reload|force-reload|restart)
66         $0 stop
67         $0 start
68         exit $?
69         ;;
70   *)
71         msg_Usage "$0 {start|stop|status|restart|reload|force-reload}"
72         exit 1
73         ;;
74 esac
75
76 exit $RETVAL
This page took 0.062838 seconds and 3 git commands to generate.