buildroot/package/shairport-sync/S99shairport-sync
Carlos Santos 6568b93929 package/shairport-sync: fix init script (stop)
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>
2018-12-21 14:55:17 +01:00

28 lines
557 B
Bash

#! /bin/sh
# Additional options that are passed to Shairport Sync
OPTIONS="-d"
case "$1" in
start)
printf "Starting shairport-sync: "
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 --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
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac