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