1 |
#! /bin/sh |
#! /bin/sh |
2 |
# |
# |
3 |
# monit Mnitor Unix systems |
# monit Monitor Unix systems |
4 |
# |
# |
5 |
# Author: Clinton Work, <work@scripty.com> |
# Author: Clinton Work, <work@scripty.com> |
6 |
# |
# |
7 |
# chkconfig: 345 98 02 |
# chkconfig: 345 98 02 |
8 |
# description: Monit is a system for monitoring processes running on a |
# description: Monit is a utility for managing and monitoring processes, |
9 |
# Unix system, and for monitoring files, directories and |
# files, directories and devices on a Unix system. |
|
# devices. |
|
10 |
# processname: monit |
# processname: monit |
11 |
# pidfile: /var/run/monit.pid |
# pidfile: /var/run/monit.pid |
12 |
# config: /etc/monitrc |
# config: /etc/monitrc |
14 |
# Source function library. |
# Source function library. |
15 |
. /etc/init.d/functions |
. /etc/init.d/functions |
16 |
|
|
17 |
[ -f /usr/bin/monit ] || exit 0 |
[ -f /usr/local/bin/monit ] || exit 0 |
18 |
|
|
19 |
RETVAL=0 |
RETVAL=0 |
20 |
|
|
22 |
case "$1" in |
case "$1" in |
23 |
start) |
start) |
24 |
echo -n "Starting monit: " |
echo -n "Starting monit: " |
25 |
daemon /usr/bin/monit -c /etc/monitrc |
daemon /usr/local/bin/monit -c /etc/monitrc |
26 |
RETVAL=$? |
RETVAL=$? |
27 |
|
|
28 |
echo |
echo |
30 |
;; |
;; |
31 |
stop) |
stop) |
32 |
echo -n "Stopping monit: " |
echo -n "Stopping monit: " |
33 |
daemon /usr/bin/monit -c /etc/monitrc quit |
daemon /usr/local/bin/monit -c /etc/monitrc quit |
34 |
RETVAL=$? |
RETVAL=$? |
35 |
|
|
36 |
echo |
echo |
37 |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/monit |
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/monit |
38 |
;; |
;; |
39 |
status) |
status) |
40 |
/usr/bin/monit -c /etc/monitrc status |
/usr/local/bin/monit -c /etc/monitrc status |
41 |
RETVAL=$? |
RETVAL=$? |
42 |
;; |
;; |
43 |
restart) |
restart) |
46 |
RETVAL=$? |
RETVAL=$? |
47 |
;; |
;; |
48 |
reload) |
reload) |
49 |
/usr/bin/monit -c /etc/monitrc reload |
/usr/local/bin/monit -c /etc/monitrc reload |
50 |
RETVAL=$? |
RETVAL=$? |
51 |
;; |
;; |
52 |
*) |
*) |