|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
#!/bin/bash
|
|
Johan Cwiklinski |
d3805ac |
#
|
|
Johan Cwiklinski |
d3805ac |
# prosody - Flexible communications server for Jabber/XMPP
|
|
Johan Cwiklinski |
d3805ac |
#
|
|
Johan Cwiklinski |
d3805ac |
# chkconfig: - 90 10
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# description: Prosody is a flexible communications server for Jabber/XMPP written in Lua. \
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# It aims to be easy to use, and light on resources. For developers it aims \
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# to be easy to extend and give a flexible system on which to rapidly develop \
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# added functionality, or prototype new protocols.
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# config: /etc/prosody/prosody.cfg.lua
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# pidfile: /var/run/prosody/prosody.pid
|
|
Johan Cwiklinski |
d3805ac |
|
|
Johan Cwiklinski |
d3805ac |
### BEGIN INIT INFO
|
|
Johan Cwiklinski |
d3805ac |
# Provides: prosody
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Required-Start: $local_fs $network $remote_fs
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Required-Stop: $local_fs $network $remote_fs
|
|
Johan Cwiklinski |
d3805ac |
# Default-Start:
|
|
Johan Cwiklinski |
d3805ac |
# Default-Stop: 0 1 6
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Short-Description: Flexible communications server for Jabber/XMPP
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Description: Prosody is a flexible communications server for Jabber/XMPP written in Lua.
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# It aims to be easy to use, and light on resources. For developers it aims
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# to be easy to extend and give a flexible system on which to rapidly develop
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# added functionality, or prototype new protocols.
|
|
Johan Cwiklinski |
d3805ac |
### END INIT INFO
|
|
Johan Cwiklinski |
d3805ac |
|
|
Johan Cwiklinski |
d3805ac |
# Source function library.
|
|
Johan Cwiklinski |
d3805ac |
. /etc/rc.d/init.d/functions
|
|
Johan Cwiklinski |
d3805ac |
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
prog="Prosody XMPP (Jabber) server"
|
|
Johan Cwiklinski |
d3805ac |
exec="/usr/bin/prosodyctl"
|
|
Johan Cwiklinski |
d3805ac |
user="prosody"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
lockfile="/var/lock/subsys/prosody"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
pidfile="/var/run/prosody/prosody.pid"
|
|
Johan Cwiklinski |
d3805ac |
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
[ -e /etc/sysconfig/prosody ] && . /etc/sysconfig/prosody
|
|
Johan Cwiklinski |
d3805ac |
|
|
Johan Cwiklinski |
d3805ac |
start() {
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
[ -x $exec ] || exit 5
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
[ -f $config ] || exit 6
|
|
Johan Cwiklinski |
d3805ac |
echo -n $"Starting $prog: "
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Avoid output "Started\n" after successful startup
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
OUTPUT="`daemon --user $user $exec start`"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
RETVAL=$?
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
echo -n "${OUTPUT/Started$'\n'/}"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
[ $RETVAL -eq 0 ] && touch $lockfile
|
|
Johan Cwiklinski |
d3805ac |
echo
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
return $RETVAL
|
|
Johan Cwiklinski |
d3805ac |
}
|
|
Johan Cwiklinski |
d3805ac |
|
|
Johan Cwiklinski |
d3805ac |
stop() {
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
6edd127 |
[ -x $exec ] || exit 5
|
|
Johan Cwiklinski |
d3805ac |
echo -n $"Stopping $prog: "
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Avoid output "Stopped\n" and "Prosody is not running\n"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
OUTPUT="`daemon $exec stop`"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
RETVAL=$?
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
OUTPUT="${OUTPUT/Stopped$'\n'/}"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
echo -n "${OUTPUT/Prosody is not running$'\n'/}"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
[ $RETVAL -eq 0 ] && rm -f $lockfile
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
echo
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
return $RETVAL
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
}
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
reload() {
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
6edd127 |
[ -x $exec ] || exit 5
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
echo -n $"Reloading $prog: "
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
# Avoid prosody specific output after successful reload
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
OUTPUT="`$exec reload`"
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
RETVAL=$?
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
[ $RETVAL -eq 0 ] && success || (echo "$OUTPUT"; failure)
|
|
Johan Cwiklinski |
d3805ac |
echo
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
return $RETVAL
|
|
Johan Cwiklinski |
d3805ac |
}
|
|
Johan Cwiklinski |
d3805ac |
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status() {
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
status -p $pidfile $exec
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
}
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status_q() {
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status > /dev/null 2>&1
|
|
Johan Cwiklinski |
d3805ac |
}
|
|
Johan Cwiklinski |
d3805ac |
|
|
Johan Cwiklinski |
d3805ac |
case "$1" in
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
start)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status_q && exit 0
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
$1
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
;;
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
stop)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status_q || exit 0
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
$1
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
;;
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
restart)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
stop
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
start
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
;;
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
reload)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status_q || exit 7
|
|
Johan Cwiklinski |
d3805ac |
$1
|
|
Johan Cwiklinski |
d3805ac |
;;
|
|
Johan Cwiklinski |
d3805ac |
force-reload)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
6edd127 |
stop
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
6edd127 |
start
|
|
Johan Cwiklinski |
d3805ac |
;;
|
|
Johan Cwiklinski |
d3805ac |
status)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status
|
|
Johan Cwiklinski |
d3805ac |
;;
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
condrestart|try-restart)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
rh_status_q || exit 0
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
stop
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
start
|
|
Johan Cwiklinski |
d3805ac |
;;
|
|
Johan Cwiklinski |
d3805ac |
*)
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
|
|
Johan Cwiklinski |
d3805ac |
exit 2
|
|
Johan Cwiklinski |
d3805ac |
esac
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
|
|
![](https://seccdn.libravatar.org/avatar/ea064b89e87b1895a84759a4950a139e0016ae503bf0eb4304a2a809343a9d75?s=16&d=retro) |
13f1b3f |
exit $?
|