logrotate: enable selinux support
[buildroot-gz.git] / package / ejabberd / S50ejabberd
blob830fcb85a77eecb512ed714f2a44b1f2178f0231
1 #!/bin/sh
3 # Start/stop ejabberd
6 CTL=/usr/sbin/ejabberdctl
7 DEFAULT=/etc/default/ejabberd
8 INSTALLUSER=ejabberd
9 RUNDIR=/var/run/ejabberd
11 # Read default configuration file if present.
12 [ -r "$DEFAULT" ] && . "$DEFAULT"
14 # Create RUNDIR.
15 mkrundir() {
16 install -d -o "$INSTALLUSER" -g "$INSTALLUSER" "$RUNDIR"
19 case "$1" in
20 start)
21 mkrundir || exit 1
22 printf "Starting ejabberd... "
23 "$CTL" start
24 # Wait until ejabberd is up and running.
25 if "$CTL" started; then
26 echo "done"
27 else
28 echo "failed"
31 stop)
32 printf "Stopping ejabberd... "
33 "$CTL" stop > /dev/null
34 if [ $? -eq 3 ] || "$CTL" stopped; then
35 echo "OK"
36 else
37 echo "failed"
40 status)
41 "$CTL" status
43 restart|force-reload)
44 "$0" stop || true
45 "$0" start
47 live)
48 mkrundir || exit 1
49 "$CTL" live
52 echo "Usage: $0 {start|stop|status|restart|force-reload|live}"
53 exit 1
54 esac