]> git.pld-linux.org Git - packages/nut.git/blob - nut-upsmon.init
- cleaning
[packages/nut.git] / nut-upsmon.init
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 network config
16 . /etc/sysconfig/network
17
18 # Get config.
19 [ -f /etc/sysconfig/upsmon ] && . /etc/sysconfig/upsmon
20
21 # See how we are called.
22 case "$1" in
23   start)
24         # Check if the service is already running?
25         if [ ! -f /var/lock/subsys/upsmon ]; then
26                 msg_starting "UPSmon"
27                 daemon upsmon
28                 [ "$?" -eq 0 ] && touch /var/lock/subsys/upsmon
29         else
30                 msg_already_running "UPSmon"
31         fi
32         ;;
33   stop)
34         if [ -f /var/lock/subsys/upsmon ]; then
35                 msg_stopping "UPSmon"
36                 killproc upsmon
37                 rm -f /var/lock/subsys/upsmon
38         else
39                 msg_not_running "UPSmon"
40         fi
41         ;;
42   restart|reload)
43         $0 stop
44         $0 start
45         ;;
46   force-reload)
47         $0 stop && $0 start
48         exit $?
49         ;;
50   status)
51         status upsmon
52         exit $?
53         ;;
54   *)
55         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
56         exit 1
57         ;;
58 esac 
This page took 0.026303 seconds and 4 git commands to generate.