Jabberd2 initscript for Debian

I was compiling and installing jabberd2 on a server at office and everything went great except for one thing: no initscript provided. I was baffled to find out that the great software didn’t have any initscript. So I wrote one:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#! /bin/sh
#
# Script to start/stop jabberd2 on a Debian
#
# by Ady Romantika, 23 August 2005
#
 
DAEMON=/usr/local/bin/jabberd
NAME=jabberd2
DESC=jabberd2
JABBERUSER=jabber
 
# Uncomment if needs debugging
DEBUG="-D"
 
# PID files base locations
PIDBASE=/usr/local/var/jabberd/pid
 
case "$1" in
   start)
   	echo -n "Starting $DESC: "
   	su $JABBERUSER -c "/usr/local/bin/jabberd $DEBUG &"
	echo "$NAME."
      ;;
   stop)
      echo -n "Stopping $DESC: "
      if [ -e $PIDBASE/router.pid ];
      then
        su $JABBERUSER -c "kill -9 `cat $PIDBASE/sm.pid`"
	echo "$NAME."
      else
        echo "jabberd2 is not started."
      fi
      # Delete the PID files as jabberd does not do this automatically
      rm -rf $PIDBASE/router.pid \
               $PIDBASE/resolver.pid \
               $PIDBASE/sm.pid \
               $PIDBASE/s2s.pid \
               $PIDBASE/c2s.pid
      ;;
   restart)
      $0 stop
      sleep 3
      $0 start
      ;;
   *)
      N=/etc/init.d/$NAME
      echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
      exit 1
      ;;
esac
 
exit 0

The script might work with other distributions with minor modifications. 🙂 

jabberd is one of the many server softwares for the popular jabber open instant messaging protocol. If you need logging for your jabber server, you might be interested in Bandersnatch provided by Funky Penguin.

Update: 31 August 2005

There’s an rc script provided for jabberd2, but it is written with Fedora in mind. The script is more complicated, and probably is better. I didn’t have the time to check it out yet. You can download it at http://www.jabberstudio.org/cgi-bin/viewcvs.cgi/jabberd2/tools/ 

0 Shares