Files
buildroot/package/mpd/S95mpd
Fiona Klute 4cc43ad014 package/mpd/S95mpd: do not wait for exit if sending stop failed
If sending the stop signal failed for whatever reason, waiting for an
existing PID file to disappear is likely to block indefinitely.

Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
Tested-by: Andreas Ziegler <br025@umbiko.net>
Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
(cherry picked from commit b2d84525f9)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2026-06-25 16:28:20 +02:00

60 lines
886 B
Bash

#!/bin/sh
#
# S95mpd Starts Music Player daemon.
#
DAEMON="mpd"
PIDFILE="/var/run/$DAEMON.pid"
# Sanity checks
[ -f /etc/$DAEMON.conf ] || exit 0
start() {
printf "Starting %s: " "$DAEMON"
start-stop-daemon --start --pidfile "$PIDFILE" \
--exec "/usr/bin/$DAEMON"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
fi
return "$status"
}
stop() {
printf "Stopping %s: " "$DAEMON"
start-stop-daemon --stop --pidfile "$PIDFILE" \
--exec "/usr/bin/$DAEMON"
status=$?
if [ "$status" -eq 0 ]; then
echo "OK"
else
echo "FAIL"
return "$status"
fi
# $DAEMON deletes its PID file on exit, wait for it to be gone
while [ -f "$PIDFILE" ]; do
sleep 0.1
done
return "$status"
}
restart() {
stop
start
}
reload() {
restart
}
case "$1" in
start|stop|reload|restart)
"$1"
;;
*)
echo "Usage: $0 {start|stop|reload|restart}"
exit 1
esac