Diffstat (limited to 'net-im/jabberd/files/jabberd-2.1.11.init') (more/less context) (ignore whitespace changes)
-rw-r--r-- | net-im/jabberd/files/jabberd-2.1.11.init | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/net-im/jabberd/files/jabberd-2.1.11.init b/net-im/jabberd/files/jabberd-2.1.11.init new file mode 100644 index 0000000..6984352 --- a/dev/null +++ b/net-im/jabberd/files/jabberd-2.1.11.init @@ -0,0 +1,75 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +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 | awk '{print $1 ":" $2}') + 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 + + ebegin "Starting $service (${cfgfile})" + start-stop-daemon \ + --background \ + --start \ + --chuid jabber:jabber \ + --exec "/usr/bin/$service" \ + -- -c "$cfgfile" + eend $? + + done + eoutdent + +} + +stop() { + + einfo "Stopping Jabber Server" + stopJabberServices + +} |