[Buildroot] [PATCH] package/shairport-sync: fix init script (stop)

Carlos Santos casantos at datacom.com.br
Thu Dec 20 22:08:52 UTC 2018


shairport-sync creates its pidfile at /var/run/shairport-sync/, so pass
that path to start-stop-daemon in the stop operation.

Also pass the executable path, allowing start-stop-daemon to check if
the PID matches the shairport-sync process, preventing killing some
other inocent daemon.

Fixes:
  https://bugs.busybox.net/show_bug.cgi?id=11566

Reported-by: Bin Zhang <yangtze31 at gmail.com>
Signed-off-by: Carlos Santos <casantos at datacom.com.br>
---
 package/shairport-sync/S99shairport-sync | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/package/shairport-sync/S99shairport-sync b/package/shairport-sync/S99shairport-sync
index 5443ed138c..ef2fa0dcd2 100644
--- a/package/shairport-sync/S99shairport-sync
+++ b/package/shairport-sync/S99shairport-sync
@@ -6,16 +6,17 @@ OPTIONS="-d"
 case "$1" in
     start)
 	printf "Starting shairport-sync: "
-	start-stop-daemon -S -q -p /var/run/shairport-sync.pid --exec /usr/bin/shairport-sync -- $OPTIONS
+	start-stop-daemon -S -q --exec /usr/bin/shairport-sync -- $OPTIONS
 	[ $? = 0 ] && echo "OK" || echo "FAIL"
 	;;
     stop)
 	printf "Stopping shairport-sync: "
-	start-stop-daemon -K -q -p /var/run/shairport-sync.pid
+	start-stop-daemon -K -q -p /var/run/shairport-sync/shairport-sync.pid
 	[ $? = 0 ] && echo "OK" || echo "FAIL"
 	;;
     restart)
 	$0 stop
+	sleep 1
 	$0 start
 	;;
     *)
-- 
2.19.2



More information about the buildroot mailing list