ejabber-servis

This commit is contained in:
milisbir 2018-09-01 18:02:18 +03:00
parent 4a482a43ea
commit 123ba5b614
1 changed files with 85 additions and 0 deletions

View File

@ -0,0 +1,85 @@
#!/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()
{
action "Starting ejabberd service: " \
"su -s /bin/sh -c '/usr/sbin/ejabberdctl start' -l ejabberd"
RETVAL=$?
[ "$RETVAL" -ne 0 ] || touch "$LOCKFILE"
return $RETVAL
}
stop()
{
action "Stopping ejabberd service: " \
"su -s /bin/sh -c '/usr/sbin/ejabberdctl stop' -l ejabberd"
RETVAL=$?
[ $RETVAL -eq 0 ] || return
sleep 3
action "Stopping erlang portmapper: " epmd -kill
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