2012-12-25 14:33:45 +01:00
|
|
|
#!/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/jabberd2/files/jabberd2-2.2.16.init,v 1.1 2009/05/08 15:24:09 gentoofan23 Exp $
|
|
|
|
|
|
|
|
depend() {
|
|
|
|
need net
|
|
|
|
use mysql postgresql slapd
|
|
|
|
provide jabber-server
|
|
|
|
}
|
|
|
|
|
|
|
|
stopJabberServices() {
|
|
|
|
|
|
|
|
eindent
|
|
|
|
for pidfile in /var/run/jabber/*.pid; do
|
|
|
|
if [ -f "${pidfile}" ]; then
|
|
|
|
service=$(basename ${pidfile} .pid)
|
|
|
|
ebegin "Stopping ${service}"
|
|
|
|
start-stop-daemon \
|
|
|
|
--stop \
|
|
|
|
--pidfile ${pidfile}
|
|
|
|
eend $?
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
eoutdent
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
|
|
|
|
|
|
einfo "Starting Jabber Server ..."
|
|
|
|
local services
|
|
|
|
services=$(grep -v ^# /etc/jabber/jabberd.cfg | grep '..*' | awk '{print $1 ":" $2}')
|
|
|
|
eindent
|
2013-01-12 16:27:18 +01:00
|
|
|
|
|
|
|
if [ ! -d /var/run/jabber ] ; then
|
|
|
|
mkdir /var/run/jabber || die "Can't create run directory /var/run/jabber"
|
|
|
|
fi
|
|
|
|
|
2012-12-25 14:33:45 +01:00
|
|
|
for service in ${services}; do
|
|
|
|
|
|
|
|
cfgfile=$(echo ${service} | cut -d ':' -f 2)
|
|
|
|
service=$(echo ${service} | cut -d ':' -f 1)
|
|
|
|
if [ ! -f "${cfgfile}" ]; then
|
|
|
|
if [ -f "/etc/jabber/${service}.xml" ]; then
|
|
|
|
cfgfile="/etc/jabber/${service}.xml"
|
|
|
|
else
|
|
|
|
eerror "Can't find: ${cfgfile} or default /etc/jabber/${service}.xml"
|
|
|
|
stopJabberServices
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
executable=/usr/bin/${service}
|
|
|
|
|
|
|
|
if [ ! -f "${executable}" ]; then
|
|
|
|
eerror "Can't find executable: ${executable}"
|
|
|
|
stopJabberServices
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
ebegin "Starting ${service} (${cfgfile})"
|
|
|
|
start-stop-daemon \
|
|
|
|
--background \
|
|
|
|
--start \
|
|
|
|
--user jabber:jabber \
|
|
|
|
--exec /usr/bin/${service} \
|
|
|
|
--pid /var/run/jabber/$(basename ${cfgfile%.xml}).pid \
|
|
|
|
-- -c ${cfgfile}
|
|
|
|
eend $?
|
|
|
|
|
|
|
|
done
|
|
|
|
eoutdent
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
stop() {
|
|
|
|
|
|
|
|
einfo "Stopping Jabber Server"
|
|
|
|
stopJabberServices
|
|
|
|
|
|
|
|
}
|