blob: ff38d9224dcff086f8b6dac9dbfc88339da4ed00 (
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#!/bin/sh
#
# Start/stop ejabberd
#
NAME=ejabberd
USER=ejabberd
RUNDIR=/var/run/ejabberd
SPOOLDIR=/var/lib/ejabberd
# Read configuration variable file if it is present.
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
mkrundir() {
install -d -o "$USER" -g "$USER" "$RUNDIR" "$SPOOLDIR"
}
# Run ejabberdctl as user $USER.
ctl() {
su $USER -c "ejabberdctl $*"
}
case "$1" in
start)
mkrundir || exit 1
echo -n "Starting ejabberd... "
ctl start --spool "$SPOOLDIR"
# Wait until ejabberd is up and running.
if ctl started; then
echo "done"
else
echo "failed"
fi
;;
stop)
echo -n "Stopping ejabberd... "
ctl stop > /dev/null
if [ $? -eq 3 ] || ctl stopped; then
echo "OK"
else
echo "failed"
fi
;;
status)
ctl status
;;
restart|force-reload)
"$0" stop
"$0" start
;;
live)
mkrundir || exit 1
ctl live
;;
*)
echo "Usage: $0 {start|stop|status|restart|force-reload|live}"
exit 1
esac
|