aboutsummaryrefslogtreecommitdiffstats
path: root/main/mqtt-exec/mqtt-exec.initd
diff options
context:
space:
mode:
authorCarlo Landmeter <clandmeter@alpinelinux.org>2018-11-28 22:12:23 +0000
committerCarlo Landmeter <clandmeter@alpinelinux.org>2018-11-28 22:12:23 +0000
commit9e14c57e60476277b5af9b626f0d15f0a18b318a (patch)
tree5f59b568cf2e5046dfd1d915b80589df98c4a6cd /main/mqtt-exec/mqtt-exec.initd
parent683d663398a7823f6e76dd5efb11fece27c1f0ca (diff)
downloadaports-9e14c57e60476277b5af9b626f0d15f0a18b318a.tar.bz2
aports-9e14c57e60476277b5af9b626f0d15f0a18b318a.tar.xz
main/mqtt-exec: initd use supervise-daemon
Diffstat (limited to 'main/mqtt-exec/mqtt-exec.initd')
-rw-r--r--main/mqtt-exec/mqtt-exec.initd25
1 files changed, 11 insertions, 14 deletions
diff --git a/main/mqtt-exec/mqtt-exec.initd b/main/mqtt-exec/mqtt-exec.initd
index 4b6b2c9627..92a64d8fb3 100644
--- a/main/mqtt-exec/mqtt-exec.initd
+++ b/main/mqtt-exec/mqtt-exec.initd
@@ -2,22 +2,24 @@
: ${mqtt_broker:="msg.alpinelinux.org"}
: ${mqtt_topics:="git/aports/$git_branch"}
-: ${exec_user:=nobody}
+: ${command_user:=nobody}
command=/usr/bin/mqtt-exec
-pidfile=/var/run/$SVCNAME/mqtt-exec.pid
+pidfile=/run/$SVCNAME/mqtt-exec.pid
+supervisor=supervise-daemon
+supervise_daemon_args="--stdout /dev/null --stderr /dev/null"
depend() {
need localmount net
after firewall
}
-start() {
- local topic
+start_pre() {
checkpath --directory --owner ${exec_user:-nobody} ${pidfile%/*}
+
set -- $command_args -h ${mqtt_broker} -v
- for topic in $mqtt_topics; do
- set -- "$@" -t "$topic"
+ local topic; for topic in $mqtt_topics; do
+ set -- "$@" -t "$topic"
done
if [ -n "$will_topic" ]; then
@@ -33,13 +35,8 @@ start() {
set -- "$@" --will-qos "$will_qos"
fi
- ebegin "Starting $SVCNAME"
- start-stop-daemon --start --stdout /dev/null --stderr /dev/null \
- --background --make-pid --user ${exec_user} \
- --pidfile ${pidfile} \
- --exec $command \
- -- "$@" \
- -- ${exec_command}
- eend
+ set -- "$@" -- ${exec_command}
+
+ command_args="$@"
}