2009-08-24 21:43:52 +02:00
|
|
|
#! /bin/sh
|
2011-05-24 23:46:25 +02:00
|
|
|
|
|
|
|
### BEGIN INIT INFO
|
|
|
|
# Provides: ejabberd
|
|
|
|
# Required-Start: $remote_fs $network $named $time
|
|
|
|
# Required-Stop: $remote_fs $network $named $time
|
|
|
|
# Default-Start: 2 3 4 5
|
|
|
|
# Default-Stop: 0 1 6
|
2021-01-11 20:18:28 +01:00
|
|
|
# Short-Description: Starts ejabberd XMPP server
|
|
|
|
# Description: Starts ejabberd XMPP server, an XMPP
|
2011-05-24 23:46:25 +02:00
|
|
|
# compliant server written in Erlang.
|
|
|
|
### END INIT INFO
|
|
|
|
|
|
|
|
# chkconfig: 2345 90 10
|
|
|
|
# description: ejabberd XMPP server
|
|
|
|
|
2009-08-24 21:43:52 +02:00
|
|
|
set -o errexit
|
|
|
|
|
2009-08-24 21:44:07 +02:00
|
|
|
DIR=@ctlscriptpath@
|
|
|
|
CTL="$DIR"/ejabberdctl
|
|
|
|
USER=@installuser@
|
2009-08-24 21:43:52 +02:00
|
|
|
|
2009-08-24 21:44:07 +02:00
|
|
|
test -x "$CTL" || {
|
2009-08-24 21:43:52 +02:00
|
|
|
echo "ERROR: ejabberd not found: $DIR"
|
|
|
|
exit 1
|
|
|
|
}
|
2014-09-17 21:28:50 +02:00
|
|
|
getent passwd "$USER" >/dev/null || {
|
2009-08-24 21:43:52 +02:00
|
|
|
echo "ERROR: System user not found: $USER"
|
|
|
|
exit 2
|
|
|
|
}
|
|
|
|
|
|
|
|
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
start)
|
|
|
|
test -x "$CTL" || exit 0
|
|
|
|
echo "Starting ejabberd..."
|
|
|
|
su - $USER -c "$CTL start"
|
|
|
|
su - $USER -c "$CTL started"
|
|
|
|
echo "done."
|
|
|
|
;;
|
|
|
|
stop)
|
|
|
|
test -x "$CTL" || exit 0
|
|
|
|
echo "Stopping ejabberd..."
|
|
|
|
su - $USER -c "$CTL stop"
|
|
|
|
su - $USER -c "$CTL stopped"
|
|
|
|
echo "done."
|
|
|
|
;;
|
2011-05-24 23:46:25 +02:00
|
|
|
status)
|
|
|
|
test -x "$CTL" || exit 0
|
|
|
|
echo "Getting ejabberd status..."
|
|
|
|
su - $USER -c "$CTL status"
|
|
|
|
;;
|
2009-08-24 21:43:52 +02:00
|
|
|
force-reload|restart)
|
|
|
|
"$0" stop
|
|
|
|
"$0" start
|
|
|
|
;;
|
|
|
|
*)
|
2011-05-24 23:46:25 +02:00
|
|
|
echo "Usage: $0 {start|stop|restart|force-reload|status}"
|
2009-08-24 21:43:52 +02:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
|
|
|
exit 0
|