author | Michael Krelin <hacker@klever.net> | 2007-04-22 23:23:39 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-04-22 23:23:39 (UTC) |
commit | d63aa3793906423bd3bffe6ab55578c162bfbbda (patch) (side-by-side diff) | |
tree | 575b6dd5d44cf5166d42b62b59f7c0623c614fc6 /net-im/jabberd/files/jabberd-2.0.11.init | |
parent | 4243b8fe439f0f819b797d908345bd8ffc067ead (diff) | |
download | misc-d63aa3793906423bd3bffe6ab55578c162bfbbda.zip misc-d63aa3793906423bd3bffe6ab55578c162bfbbda.tar.gz misc-d63aa3793906423bd3bffe6ab55578c162bfbbda.tar.bz2 |
net-im/jabberd: imported from portage
Diffstat (limited to 'net-im/jabberd/files/jabberd-2.0.11.init') (more/less context) (show whitespace changes)
-rw-r--r-- | net-im/jabberd/files/jabberd-2.0.11.init | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/net-im/jabberd/files/jabberd-2.0.11.init b/net-im/jabberd/files/jabberd-2.0.11.init new file mode 100644 index 0000000..fee8d2e --- a/dev/null +++ b/net-im/jabberd/files/jabberd-2.0.11.init @@ -0,0 +1,80 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-im/jabberd/files/jabberd-2.0.11.init,v 1.3 2007/01/09 10:38:59 nelchael Exp $ + +depend() { + need net + use mysql postgresql slapd + provide jabber-server +} + +function 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=$(grep -v ^# /etc/jabber/jabberd.cfg | grep '..*' | awk '{print $1 ":" $2}') + local tempPidHack=/var/run/jabber/start_stop_daemon.pid + eindent + for service in ${services}; do + + cfgfile=${service/*:/} + service=${service/:*/} + 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 + + rm -f ${tempPidHack} &> /dev/null + ebegin "Starting ${service} (${cfgfile})" + start-stop-daemon \ + --background \ + --start \ + --chuid jabber:jabber \ + --exec /usr/bin/${service} \ + --pid ${tempPidHack} \ + --make-pidfile \ + -- -c ${cfgfile} + eend $? + rm -f ${tempPidHack} &> /dev/null + + done + eoutdent + +} + +stop() { + + einfo "Stopping Jabber Server" + stopJabberServices + +} |