Debian's Jabber init
script
Download, Add a comment, Back to main page
Notice that there are actually two files in this one text file.
The first is a config file called by the second.
-- config-file --
#!/bin/sh
#
# jabber.cfg
#
# Copyright (c) 2000, Bernd Eckenfels <ecki@debian.org>
#
# This File is licensed under the GPL.
#
# This Shell script will be sourced by /etc/init.d/jabber to set variables
#
# NOTE: take care to actually USE <host><jabberd:cmdline flag="h"/></host>
# and
# <spool><jabberd:cmdline flag="s">/var/lib/jabber</jabberd:cmdline></spool>
# in the /etc/jabber/jabber.xml file
# JABBER_HOSTNAME (which is then passed to jabberd in the -h switch)
# JABBER_HOSTNAME=localhost
# JABBER_SPOOL (whic is passed to jabberd in the -s switch)
# JABBER_SPOOL=/var/lib/jabber
export JABBER_HOSTNAME JABBER_SPOOL
-- config-file --
-- init-file --
#! /bin/sh
#
# jabber init script to start jabber daemon
#
# Created from Bernd Eckenfels <ecki@lina.inka.de>
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux
# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl
#
# This file was automatically customized by dh-make on Sun, 21 May 2000 12:31:20
+0200
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/jabberd
NAME=jabberd
DESC=jabberd
CONF=/etc/jabber/jabber.xml
PID=/var/run/jabber/jabber.pid
CMDLINE=""
test -f $DAEMON -a -f $CONF || exit 0
# set some parameters like JABBER_HOSTNAME
if test -x /etc/jabber/jabber.cfg; then
. /etc/jabber/jabber.cfg
fi
if [ x"$JABBER_HOSTNAME" != x"" ]; then
CMDLINE="$CMDLINE -h $JABBER_HOSTNAME"
fi
if [ x"$JABBER_SPOOL" != x"" ]; then
CMDLINE="$CMDLINE -s $JABBER_SPOOL"
fi
if [ x"$CMDLINE" != x"" ]; then
CMDLINE="-- $CMDLINE"
fi
set -e
case "$1" in
start)
# check for PID file
if [ -f $PID ]; then
# PID file is there, is it readable?
if [ -r $PID ]; then
# it's readable, is there a process?
if [ "$NAME" = "`ps -p`cat $PID` -o ucmd h`" ]; then
# looks like it's already running
echo "$NAME is already running."
exit 1
else
# looks like a stale PID file
rm -f $PID
fi
else
echo "$PID file exists, but is not accessible."
exit 1
fi
fi
echo -n "Starting $DESC: "
cd /usr/lib/jabber/
start-stop-daemon -b -c daemon --start --quiet
--pidfile $PID --exec $DAEMON $CMDLINE
sleep 2
if pidof $DAEMON &> /dev/null; then
echo "$NAME."
else
echo -n "<Failed>"
fi
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet
--retry 5 --exec $DAEMON || echo -n "<Failed> "
echo "$NAME."
;;
reload|force-reload)
echo "Reloading $DESC configuration files."
start-stop-daemon --stop --signal 1 --quiet
--pidfile $PID --exec $DAEMON
;;
restart)
$0 stop
$0 start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0
-- init-file --