package/shairport-sync: fix init script (stop)
authorCarlos Santos <casantos@datacom.com.br>
Thu, 20 Dec 2018 22:18:38 +0000 (20:18 -0200)
committerPeter Korsgaard <peter@korsgaard.com>
Fri, 21 Dec 2018 13:55:17 +0000 (14:55 +0100)
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@gmail.com>
Signed-off-by: Carlos Santos <casantos@datacom.com.br>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
package/shairport-sync/S99shairport-sync

index 5443ed138cd5df23c71a66d7af447bb9c6e86de7..80b2fddbc69dbb41d4c587def36c164c70b927ff 100644 (file)
@@ -6,16 +6,18 @@ 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 --exec /usr/bin/shairport-sync \
+               -p /var/run/shairport-sync/shairport-sync.pid
        [ $? = 0 ] && echo "OK" || echo "FAIL"
        ;;
     restart)
        $0 stop
+       sleep 1
        $0 start
        ;;
     *)