]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # upsmon NUT daemon monitoring tool | |
4 | # | |
5 | # chkconfig: 2345 10 90 | |
6 | # | |
7 | # description: upsmon talks to upsd and notifies of ups status changes, \ | |
8 | # also shutting systems down if required. | |
9 | # processname: upsmon | |
10 | # config: /etc/ups/ | |
11 | ||
12 | # Source function library. | |
13 | . /etc/rc.d/init.d/functions | |
14 | ||
15 | # Get config. | |
16 | [ -f /etc/sysconfig/upsmon ] && . /etc/sysconfig/upsmon | |
17 | ||
18 | RETVAL=0 | |
19 | # See how we are called. | |
20 | case "$1" in | |
21 | start) | |
22 | # Check if the service is already running? | |
23 | if [ ! -f /var/lock/subsys/upsmon ]; then | |
24 | msg_starting "UPSmon" | |
25 | daemon upsmon $PROGRAM_ARGS | |
26 | RETVAL=$? | |
27 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/upsmon | |
28 | else | |
29 | msg_already_running "UPSmon" | |
30 | fi | |
31 | ;; | |
32 | stop) | |
33 | if [ -f /var/lock/subsys/upsmon ]; then | |
34 | msg_stopping "UPSmon" | |
35 | killproc upsmon | |
36 | rm -f /var/lock/subsys/upsmon | |
37 | else | |
38 | msg_not_running "UPSmon" | |
39 | fi | |
40 | ;; | |
41 | restart|force-reload) | |
42 | $0 stop | |
43 | $0 start | |
44 | exit $? | |
45 | ;; | |
46 | status) | |
47 | status upsmon | |
48 | exit $? | |
49 | ;; | |
50 | *) | |
51 | msg_usage "$0 {start|stop|restart|force-reload|status}" | |
52 | exit 3 | |
53 | esac | |
54 | ||
55 | exit $RETVAL |