aboutsummaryrefslogtreecommitdiff
path: root/network/jabberd2/rc.jabberd2
blob: ca328a6df37ac4be8e020ca5bdf77b11d26ed03f (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
#!/bin/sh

jabberd2_start() {
  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