]>
Commit | Line | Data |
---|---|---|
dfab42e0 AM |
1 | #!/bin/sh |
2 | # | |
3 | # monit Monitoring daemon | |
4 | # | |
5 | # chkconfig: 345 99 1 | |
6 | # description: Monitoring daemon | |
7 | # | |
8 | ||
9 | # Source function library | |
10 | . /etc/rc.d/init.d/functions | |
11 | ||
12 | # Get service config | |
13 | [ -f /etc/sysconfig/monit ] && . /etc/sysconfig/monit | |
14 | ||
15 | # See how we were called. | |
16 | case "$1" in | |
17 | start) | |
18 | # Check if the service is already running? | |
19 | if [ ! -f /var/lock/subsys/monit ]; then | |
20 | msg_starting monit | |
21 | daemon monit -c /etc/monitrc -l syslog -d 60 | |
dfab42e0 AM |
22 | RETVAL=$? |
23 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/monit | |
24 | else | |
25 | msg_already_running monit | |
26 | exit 1 | |
27 | fi | |
28 | ;; | |
29 | stop) | |
30 | # Stop daemons. | |
31 | if [ -f /var/lock/subsys/monit ]; then | |
32 | msg_stopping monit | |
33 | killproc monit | |
34 | RETVAL=$? | |
35 | rm -f /var/lock/subsys/monit > /dev/null 2>&1 | |
36 | else | |
37 | msg_not_running monit | |
38 | exit 1 | |
39 | fi | |
40 | ;; | |
41 | status) | |
42 | status monit | |
43 | RETVAL=$? | |
44 | ;; | |
45 | restart) | |
46 | $0 stop | |
47 | $0 start | |
48 | ;; | |
49 | reload) | |
50 | msg_reloading monit | |
51 | killproc monit -HUP | |
52 | RETVAL=$? | |
53 | ;; | |
54 | *) | |
55 | msg_usage "$0 {start|stop|reload|restart|status}" | |
56 | exit 1 | |
57 | ;; | |
58 | esac | |
59 | ||
60 | exit $RETVAL | |
61 |