This repository has been archived by the owner on Jan 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
/
monit.init.erb
72 lines (63 loc) · 1.47 KB
/
monit.init.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /bin/sh
#
# monit Monitor Unix systems
#
# Author: Clinton Work, <work@scripty.com>
#
# chkconfig: 2345 98 02
# description: Monit is a utility for managing and monitoring processes,
# files, directories and filesystems on a Unix system.
# processname: monit
# pidfile: /var/run/monit.pid
# config: /etc/monit.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
MONIT=/usr/bin/monit
# Source monit configuration.
if [ -f /etc/sysconfig/monit ] ; then
. /etc/sysconfig/monit
fi
CONFIG="<%= @config %>"
MONIT_OPTS="-c $CONFIG $MONIT_OPTS"
[ -f $MONIT ] || exit 0
RETVAL=0
# See how we were called.
case "$1" in
start)
echo -n "Starting monit: "
daemon $NICELEVEL $MONIT $MONIT_OPTS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/monit
;;
stop)
echo -n "Stopping monit: "
killproc monit
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/monit
;;
restart)
$0 stop
$0 start
RETVAL=$?
;;
reload)
echo -n "Reloading monit: "
$MONIT $MONIT_OPTS reload
RETVAL=$?
;;
condrestart)
[ -e /var/lock/subsys/monit ] && $0 restart
;;
status)
status monit
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|condrestart|status}"
exit 1
esac
exit $RETVAL