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