summaryrefslogtreecommitdiff
blob: 8a150dc8eefb61b46231777f10f971011fee7663 (plain)
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
#!/sbin/runscript
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-im/ejabberd/files/ejabberd-2.initd,v 1.1 2009/04/09 05:40:39 pva Exp $

opts="${opts} reload"

depend() {
	use dns
	need net
	provide jabber-server
}

checkconfig() {
	if [ ! -e /etc/jabber/ejabberd.cfg ] ; then
		eerror "You need a /etc/jabber/ejabberd.cfg file to run ejabberd"
		return 1
	fi
}

start() {
	checkconfig || return 1
	ebegin "Starting ejabberd"
	# the process name of beam is different depending whether smp is used.
	# set it explicitly so start-stop-daemon works
	case "$HAVE_SMP" in
		"1"|"true"|"yes")
			BEAMNAME="beam.smp"
			SMPOPT="auto"
		;;
		*)
			BEAMNAME="beam"
			SMPOPT="disable"
		;;
	esac
	cd /var/lib/ejabberd
	start-stop-daemon --start --quiet --chuid jabber:jabber \
		--name $BEAMNAME \
		--exec /usr/sbin/ejabberd -- -detached -noinput -smp $SMPOPT
	eend $?
}

stop() {
	ebegin "Stopping ejabberd"
	/usr/sbin/ejabberdctl stop
	eend $?
}

reload() {
	ebegin "Reloading ejabberd"
	/usr/sbin/ejabberdctl reopen-log
	eend $?
}