]> git.pld-linux.org Git - packages/monit.git/blob - monit.init
- unify msg_not_running usage
[packages/monit.git] / monit.init
1 #!/bin/sh
2 #
3 # monit         Monitoring daemon
4 #
5 # chkconfig:    345 99 01
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 RETVAL=0
16 # See how we were called.
17 case "$1" in
18   start)
19         # Check if the service is already running?
20         if [ ! -f /var/lock/subsys/monit ]; then
21                 msg_starting monit
22                 daemon monit -c /etc/monitrc -l syslog -d 60
23                 RETVAL=$?
24                 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/monit
25         else
26                 msg_already_running monit
27         fi
28         ;;
29   stop)
30         # Stop daemons.
31         if [ -f /var/lock/subsys/monit ]; then
32                 msg_stopping monit
33                 daemon monit -c /etc/monitrc quit
34                 rm -f /var/lock/subsys/monit > /dev/null 2>&1
35         else
36                 msg_not_running monit
37         fi
38         ;;
39   status)
40         status monit
41         monit -c /etc/monitrc status
42         exit $?
43         ;;
44   restart)
45         $0 stop
46         $0 start
47         exit $?
48         ;;
49   reload|force-reload)
50         if [ -f /var/lock/subsys/monit ]; then
51                 msg_reloading monit
52                 daemon monit -c /etc/monitrc reload
53                 RETVAL=$?
54         else
55                 msg_not_running monit
56                 exit 7
57         fi
58         ;;
59   *)
60         msg_usage "$0 {start|stop|restart|reload|force-reload|status}"
61         exit 3
62 esac
63
64 exit $RETVAL
This page took 0.060255 seconds and 4 git commands to generate.