2015-01-12 10:32:20 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Start/stop ejabberd
|
|
|
|
#
|
|
|
|
|
2015-07-08 11:54:15 +02:00
|
|
|
CTL=/usr/sbin/ejabberdctl
|
2020-01-06 17:11:14 +01:00
|
|
|
DEFAULT=/etc/ejabberd/ejabberdctl.cfg
|
2015-07-08 11:54:15 +02:00
|
|
|
INSTALLUSER=ejabberd
|
2015-01-12 10:32:20 +01:00
|
|
|
RUNDIR=/var/run/ejabberd
|
2015-04-15 17:39:06 +02:00
|
|
|
|
2015-07-08 11:54:15 +02:00
|
|
|
# Read default configuration file if present.
|
|
|
|
[ -r "$DEFAULT" ] && . "$DEFAULT"
|
2015-01-12 10:32:20 +01:00
|
|
|
|
2015-07-08 11:54:15 +02:00
|
|
|
# Create RUNDIR.
|
2015-01-12 10:32:20 +01:00
|
|
|
mkrundir() {
|
2015-07-08 11:54:15 +02:00
|
|
|
install -d -o "$INSTALLUSER" -g "$INSTALLUSER" "$RUNDIR"
|
2015-01-12 10:32:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
2015-04-15 17:39:05 +02:00
|
|
|
mkrundir || exit 1
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Starting ejabberd... "
|
2015-07-08 11:54:15 +02:00
|
|
|
"$CTL" start
|
2015-04-15 17:39:07 +02:00
|
|
|
# Wait until ejabberd is up and running.
|
2015-07-08 11:54:15 +02:00
|
|
|
if "$CTL" started; then
|
2015-04-15 17:39:07 +02:00
|
|
|
echo "done"
|
|
|
|
else
|
|
|
|
echo "failed"
|
|
|
|
fi
|
2015-01-12 10:32:20 +01:00
|
|
|
;;
|
|
|
|
stop)
|
2015-10-03 23:29:57 +02:00
|
|
|
printf "Stopping ejabberd... "
|
2015-07-08 11:54:15 +02:00
|
|
|
"$CTL" stop > /dev/null
|
|
|
|
if [ $? -eq 3 ] || "$CTL" stopped; then
|
2015-01-12 10:32:20 +01:00
|
|
|
echo "OK"
|
|
|
|
else
|
|
|
|
echo "failed"
|
|
|
|
fi
|
|
|
|
;;
|
2015-04-15 17:39:05 +02:00
|
|
|
status)
|
2015-07-08 11:54:15 +02:00
|
|
|
"$CTL" status
|
2015-04-15 17:39:05 +02:00
|
|
|
;;
|
|
|
|
restart|force-reload)
|
2015-07-08 11:54:15 +02:00
|
|
|
"$0" stop || true
|
2015-01-12 10:32:20 +01:00
|
|
|
"$0" start
|
|
|
|
;;
|
2015-04-15 17:39:05 +02:00
|
|
|
live)
|
|
|
|
mkrundir || exit 1
|
2015-07-08 11:54:15 +02:00
|
|
|
"$CTL" live
|
2015-04-15 17:39:05 +02:00
|
|
|
;;
|
2015-01-12 10:32:20 +01:00
|
|
|
*)
|
2015-04-15 17:39:05 +02:00
|
|
|
echo "Usage: $0 {start|stop|status|restart|force-reload|live}"
|
2015-01-12 10:32:20 +01:00
|
|
|
exit 1
|
|
|
|
esac
|