repo: music
action: commit
revision: 
path_from: 
revision_from: 45a59dd7666c856a9ea3a7e4bcedb7663f8660c7:
path_to: 
revision_to: 
git.thebackupbox.net
music
git clone git://git.thebackupbox.net/music
commit 45a59dd7666c856a9ea3a7e4bcedb7663f8660c7
Author: epoch 
Date:   Fri Jan 15 05:15:28 2021 -0600

    music-stop now uses SIGINT and sends it to children too

diff --git a/music-stop b/music-stop
index 0f8939257841b2b31b9eaaf9e2957ab3c2708af9..
index ..878712ce5aa797ebbbb1903781079a3423536caa 100755
--- a/music-stop
+++ b/music-stop
@@ -5,12 +5,19 @@ file="${PREFIX}/run/music/init.pid"
 if [ -f "$file" ];then
   pid="$(cat "$file")"
   rm -f "$file"
-  kill -9 "$pid"
+  if [ "$(ps -h -o cmd -p "$pid")" = "qargs music-player" ];then
+    printf "found qargs music-player running with pid %d. killing.\n" "$pid" >&2
+    pkill -2 -P "$pid"
+    kill -2 "$pid"
+  else
+    printf "stale init.pid\n" >&2
+  fi
   file="${PREFIX}/run/music/player.pid"
   if [ -f "$file" ];then
     pid="$(cat "$file")"
     rm -f "$file"
-    kill -9 "$pid"
+    pkill -2 -P "$pid"
+    kill -2 "$pid"
     exit 0
   fi
   logger -n logserver "player.pid was missing."

-----END OF PAGE-----