2018-09-01 17:02:18 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# ejabberd XMPP server
|
|
|
|
#
|
|
|
|
# chkconfig: - 70 30
|
|
|
|
# description: Fault-tolerant XMPP server.
|
|
|
|
#
|
|
|
|
# processname: so many
|
|
|
|
# config: /etc/ejabberd/ejabberd.cfg
|
|
|
|
# pidfile: nope
|
|
|
|
|
|
|
|
WITHOUT_RC_COMPAT=1
|
|
|
|
|
|
|
|
# Source function library.
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
|
|
|
|
LOCKFILE=/var/lock/ejabberdctl
|
|
|
|
RETVAL=0
|
|
|
|
|
|
|
|
start()
|
|
|
|
{
|
2018-09-01 17:54:55 +02:00
|
|
|
echo "Starting ejabberd service: "
|
|
|
|
su -s /bin/sh -c '/usr/sbin/ejabberdctl start' -l ejabberd
|
2018-09-01 17:02:18 +02:00
|
|
|
RETVAL=$?
|
|
|
|
[ "$RETVAL" -ne 0 ] || touch "$LOCKFILE"
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
stop()
|
|
|
|
{
|
2018-09-01 17:54:55 +02:00
|
|
|
echo "Stopping ejabberd service: "
|
|
|
|
su -s /bin/sh -c '/usr/sbin/ejabberdctl stop' -l ejabberd
|
2018-09-01 17:02:18 +02:00
|
|
|
RETVAL=$?
|
|
|
|
[ $RETVAL -eq 0 ] || return
|
|
|
|
sleep 3
|
2018-09-01 17:54:55 +02:00
|
|
|
echo "Stopping erlang portmapper: "
|
|
|
|
epmd -kill
|
2018-09-01 17:02:18 +02:00
|
|
|
RETVAL=$?
|
|
|
|
[ "$RETVAL" -ne 0 ] || rm -f -- "$LOCKFILE"
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
restart()
|
|
|
|
{
|
|
|
|
stop
|
|
|
|
sleep 2
|
|
|
|
start
|
|
|
|
}
|
|
|
|
|
|
|
|
status()
|
|
|
|
{
|
|
|
|
ejabberdctl status
|
|
|
|
RETVAL=$?
|
|
|
|
return $RETVAL
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
start
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
stop
|
|
|
|
;;
|
|
|
|
restart|reload)
|
|
|
|
restart
|
|
|
|
;;
|
|
|
|
condstop)
|
|
|
|
if [ -e "$LOCKFILE" ]; then
|
|
|
|
stop
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
condrestart|condreload)
|
|
|
|
if [ -e "$LOCKFILE" ]; then
|
|
|
|
restart
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
status)
|
|
|
|
status
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
|
|
|
|
RETVAL=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit $RETVAL
|