Subversion Repositories configs

Rev

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

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