aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Johan Oudinet <johan.oudinet@gmail.com>2015-04-15 17:39:05 +0200
committerGravatar Thomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-04-19 11:11:07 +0200
commit0972c9c10b3aa9466528fb5a0f30f37545b2c876 (patch)
tree563b875661709872ed125495f945af369fdeef93
parent7e66b9905dd7bd355560235197e5f31d1d6197bb (diff)
downloadbuildroot-0972c9c10b3aa9466528fb5a0f30f37545b2c876.tar.gz
buildroot-0972c9c10b3aa9466528fb5a0f30f37545b2c876.tar.bz2
ejabberd: start the daemon as ejabberd user
ejabberd.mk creates an ejabberd user but the init script was starting the xmpp server as root user. This patch fixes it by invoking ejabberctl from a "su ejabberd -c" command. Signed-off-by: Johan Oudinet <johan.oudinet@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--package/ejabberd/S50ejabberd28
1 files changed, 20 insertions, 8 deletions
diff --git a/package/ejabberd/S50ejabberd b/package/ejabberd/S50ejabberd
index 265630712d..925a072ddc 100644
--- a/package/ejabberd/S50ejabberd
+++ b/package/ejabberd/S50ejabberd
@@ -7,29 +7,41 @@ USER=ejabberd
RUNDIR=/var/run/ejabberd
mkrundir() {
- install -d -o $USER -g $USER $RUNDIR
+ install -d -o "$USER" -g "$USER" "$RUNDIR"
+}
+
+# Run ejabberdctl as user $USER.
+ctl() {
+ su $USER -c "ejabberdctl $*"
}
case "$1" in
start)
- mkrundir
- echo "Starting ejabberd..."
- ejabberdctl start
+ mkrundir || exit 1
+ echo -n "Starting ejabberd... "
+ ctl start
;;
stop)
echo -n "Stopping ejabberd... "
- ejabberdctl stop > /dev/null
- if [ $? -eq 3 ] || ejabberdctl stopped; then
+ ctl stop > /dev/null
+ if [ $? -eq 3 ] || ctl stopped; then
echo "OK"
else
echo "failed"
fi
;;
- restart|reload)
+ status)
+ ctl status
+ ;;
+ restart|force-reload)
"$0" stop
"$0" start
;;
+ live)
+ mkrundir || exit 1
+ ctl live
+ ;;
*)
- echo "Usage: $0 {start|stop|restart}"
+ echo "Usage: $0 {start|stop|status|restart|force-reload|live}"
exit 1
esac