mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
package/bluez5_utils: tidy up the init script
* use long-form options * consistently use start-stop-daemon with --exec * wait for process to be gone and delete PID file on stop Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
421a92a897
commit
8ea76e0986
@@ -11,7 +11,8 @@ BLUETOOTHD_ARGS="-n"
|
|||||||
start() {
|
start() {
|
||||||
printf 'Starting %s: ' "$DAEMON"
|
printf 'Starting %s: ' "$DAEMON"
|
||||||
# shellcheck disable=SC2086 # we need the word splitting
|
# shellcheck disable=SC2086 # we need the word splitting
|
||||||
start-stop-daemon -S -q -m -b -p "$PIDFILE" -x "/usr/libexec/bluetooth/$DAEMON" \
|
start-stop-daemon --start --background --make-pidfile \
|
||||||
|
--pidfile "$PIDFILE" --exec "/usr/libexec/bluetooth/$DAEMON" \
|
||||||
-- $BLUETOOTHD_ARGS
|
-- $BLUETOOTHD_ARGS
|
||||||
status=$?
|
status=$?
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
@@ -24,25 +25,32 @@ start() {
|
|||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
printf 'Stopping %s: ' "$DAEMON"
|
printf 'Stopping %s: ' "$DAEMON"
|
||||||
start-stop-daemon -K -q -p "$PIDFILE"
|
start-stop-daemon --stop --pidfile "$PIDFILE" \
|
||||||
|
--exec "/usr/libexec/bluetooth/$DAEMON"
|
||||||
status=$?
|
status=$?
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
else
|
else
|
||||||
echo "FAIL"
|
echo "FAIL"
|
||||||
|
return "$status"
|
||||||
fi
|
fi
|
||||||
|
while start-stop-daemon --stop --test --quiet --pidfile "$PIDFILE" \
|
||||||
|
--exec "/usr/libexec/bluetooth/$DAEMON"; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
rm -f "$PIDFILE"
|
||||||
return "$status"
|
return "$status"
|
||||||
}
|
}
|
||||||
|
|
||||||
restart() {
|
restart() {
|
||||||
stop
|
stop
|
||||||
sleep 1
|
|
||||||
start
|
start
|
||||||
}
|
}
|
||||||
|
|
||||||
reload() {
|
reload() {
|
||||||
printf 'Reloading %s: ' "$DAEMON"
|
printf 'Reloading %s: ' "$DAEMON"
|
||||||
start-stop-daemon -K -s HUP -q -p "$PIDFILE"
|
start-stop-daemon --stop --signal HUP -q --pidfile "$PIDFILE" \
|
||||||
|
--exec "/usr/libexec/bluetooth/$DAEMON"
|
||||||
status=$?
|
status=$?
|
||||||
if [ "$status" -eq 0 ]; then
|
if [ "$status" -eq 0 ]; then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
|||||||
Reference in New Issue
Block a user