Subversion Repositories configs

Rev

Rev 43 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# zarafa-monitor Zarafa Collaboration Platform's Quota Monitor
4
#
5
# chkconfig: 345 86 24
6
# description: The Zarafa Quota Monitor watches the store sizes \
7
#              of users, and sends warning emails when limits are exceeded.
43 - 8
# processname: /usr/sbin/zarafa-monitor
4 - 9
# config: /etc/zarafa/monitor.cfg
59 - 10
# pidfile: /var/run/zarafad/monitor.pid
4 - 11
 
12
### BEGIN INIT INFO
13
# Provides: zarafa-monitor
14
# Required-Start: $local_fs $network $remote_fs $syslog
15
# Required-Stop: $local_fs $network $remote_fs $syslog
16
# Should-Start: zarafa-server
17
# Should-Stop: zarafa-server
18
# Short-Description: Zarafa Collaboration Platform's Quota Monitor
19
# Description: The Zarafa Quota Monitor watches the store sizes
20
#              of users, and sends warning emails when limits are exceeded.
21
### END INIT INFO
22
 
23
MONITORCONFIG=/etc/zarafa/monitor.cfg
43 - 24
MONITORPROGRAM=/usr/sbin/zarafa-monitor
4 - 25
 
26
# Sanity checks.
27
[ -x $MONITORPROGRAM ] || exit 0
28
 
29
MONITORCONFIG_OPT=""
30
[ ! -z $MONITORCONFIG -a -f $MONITORCONFIG ] && MONITORCONFIG_OPT="-c $MONITORCONFIG"
31
 
32
[ -f /etc/sysconfig/zarafa ] && . /etc/sysconfig/zarafa
33
if [ -z "$ZARAFA_LOCALE" ]; then
34
	ZARAFA_LOCALE="C"
35
fi
36
 
37
# Source function library.
38
. /etc/rc.d/init.d/functions
39
 
40
RETVAL=0
41
monitor=`basename $MONITORPROGRAM`
42
lockfile=/var/lock/subsys/$monitor
59 - 43
pidfile=/var/run/zarafad/monitor.pid
4 - 44
 
45
start() {
46
	# Start in background, always succeeds
47
	echo -n $"Starting $monitor: "
59 - 48
	install -dm0775 -o zarafa -g zarafa /var/run/zarafad
4 - 49
	export LC_ALL=$ZARAFA_LOCALE
50
	export LANG=$ZARAFA_LOCALE
51
	daemon $MONITORPROGRAM $MONITORCONFIG_OPT
52
	RETVAL=$?
53
	unset LC_ALL LANG
54
	echo
55
	[ $RETVAL -eq 0 ] && touch $lockfile
56
 
57
	return $RETVAL
58
}
59
 
60
stop() {
61
	echo -n $"Stopping $monitor: "
62
	killproc $MONITORPROGRAM
63
	RETVAL=$?
64
	echo
65
	[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
66
 
67
	return $RETVAL
68
}
69
 
70
restart() {
71
	stop
72
	start
73
}
74
 
75
reload() {
76
	echo -n $"Restarting $monitor: "
77
	killproc $MONITORPROGRAM -SIGHUP
78
	RETVAL=$?
79
	echo
80
 
81
	return $RETVAL
82
}
83
 
84
# See how we were called.
85
case "$1" in
86
    start)
87
		start
88
		;;
89
    stop)
90
		stop
91
		;;
92
    status)
93
		status $monitor
94
		RETVAL=$?
95
		;;
96
    restart|force-reload)
97
		restart
98
		;;
99
    condrestart|try-restart)
100
		if [ -f ${pidfile} ]; then
101
			stop
102
			start
103
		fi
104
		;;
105
    reload)
106
		reload
107
		;;
108
    *)
109
		echo $"Usage: $monitor {start|stop|status|reload|restart|condrestart|force-reload|try-restart}"
110
		RETVAL=1
111
		;;
112
esac
113
 
114
exit $RETVAL