summaryrefslogtreecommitdiff
path: root/network/jabberd2/rc.jabberd2
blob: c5e8a70f5476d775155f52e5d9f8a95e7e61abcd (plain)
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
#!/bin/sh

jabberd2_start() {
  mkdir -p /var/run/jabberd2
  chown %JABBERUSR% /var/run/jabberd2
  su - %JABBERUSR% -c '/usr/bin/jabberd &'
}

jabberd2_stop() {
  if [ -e /var/run/jabberd2/router.pid ]; then
    kill `cat /var/run/jabberd2/router.pid 2> /dev/null` 2> /dev/null
    rm /var/run/jabberd2/router.pid
  fi
  if [ -e /var/run/jabberd2/c2s.pid ]; then
    kill `cat /var/run/jabberd2/c2s.pid 2> /dev/null` 2> /dev/null
    rm /var/run/jabberd2/c2s.pid
  fi
  if [ -e /var/run/jabberd2/s2s.pid ]; then
    kill `cat /var/run/jabberd2/s2s.pid 2> /dev/null` 2> /dev/null
    rm /var/run/jabberd2/s2s.pid
  fi
  if [ -e /var/run/jabberd2/sm.pid ]; then
    kill `cat /var/run/jabberd2/sm.pid 2> /dev/null` 2> /dev/null
    rm /var/run/jabberd2/sm.pid
  fi
}

case "$1" in
start)
  jabberd2_start
  ;;
stop)
  jabberd2_stop
  ;;
restart)
  jabberd2_stop
  sleep 2
  jabberd2_start
  ;;
*)
  echo "Usage $0 (start|stop|restart|status)"
esac