You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-overlay/net-im/calculate-ejabberd/files/ejabberd-2.0.5-r3.initd

68 lines
1.6 KiB

#!/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.0.2.initd,v 1.1 2008/08/03 16:19:05 caleb Exp $
opts="${opts} reload"
depend() {
use dns slapd
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="enable"
;;
*)
BEAMNAME="beam"
SMPOPT="disable"
;;
esac
cd /var/lib/ejabberd
PIDFILE=/var/run/jabber/ejabber.pid
start-stop-daemon --start --pidfile $PIDFILE --quiet --chuid jabber:jabber \
--name $BEAMNAME \
--exec /usr/sbin/ejabberd -- -detached -noinput -smp $SMPOPT
# find pid of ejabberd process
ps axo pid,cmd | sed -nr "/${BEAMNAME}.*ejabberd/ {/delsed/d;s/^\s*([0-9]+).*/\1/p}" >$PIDFILE
eend $?
}
stop() {
ebegin "Stopping ejabberd"
/usr/sbin/ejabberdctl stop
RES=$?
sleep 1
if ps ax | grep "epmd -daemon" | grep -v "grep" >/dev/null;
then
kill `ps ax | grep "epmd -daemon" | grep -v "grep" | awk '{print $1;}'`
fi
if ps ax | grep "ejabber" | grep "beam" >/dev/null;
then
kill `ps ax | grep "ejabber" | grep "beam" | awk '{print $1}'`
fi
eend $RES
}
reload() {
ebegin "Reloading ejabberd"
/usr/sbin/ejabberdctl reopen-log
eend $?
}