Subversion Repositories configs

Rev

Rev 23 | Rev 59 | Go to most recent revision | 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
9
# pidfile: /var/run/zarafa-presence.pid
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
41
pidfile=/var/run/$presence.pid
42
 
43
start() {
44
	# Start in background, always succeeds
45
	echo -n $"Starting $presence: "
46
	export LC_ALL=$ZARAFA_LOCALE
47
	export LANG=$ZARAFA_LOCALE
48
	daemon $PRESENCEPROGRAM $PRESENCECONFIG_OPT
49
	RETVAL=$?
50
	unset LC_ALL LANG
51
	echo
52
	[ $RETVAL -eq 0 ] && touch $lockfile
53
 
54
	return $RETVAL
55
}
56
 
57
stop() {
58
	echo -n $"Stopping $presence: "
59
	killproc $PRESENCEPROGRAM
60
	RETVAL=$?
61
	echo
62
	[ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile
63
 
64
	return $RETVAL
65
}
66
 
67
restart() {
68
	stop
69
	start
70
}
71
 
72
reload() {
73
	echo -n $"Restarting $presence: "
74
	killproc $PRESENCEPROGRAM -SIGHUP
75
	RETVAL=$?
76
	echo
77
 
78
	return $RETVAL
79
}
80
 
81
# See how we were called.
82
case "$1" in
83
    start)
84
		start
85
		;;
86
    stop)
87
		stop
88
		;;
89
    status)
90
		status $presence
91
		RETVAL=$?
92
		;;
93
    restart|force-reload)
94
		restart
95
		;;
96
    condrestart|try-restart)
97
		if [ -f ${pidfile} ]; then
98
			stop
99
			start
100
		fi
101
		;;
102
    reload)
103
		reload
104
		;;
105
    *)
106
		echo $"Usage: $presence {start|stop|status|reload|restart|condrestart|force-reload|try-restart}"
107
		RETVAL=1
108
		;;
109
esac
110
 
111
exit $RETVAL