-- Leo's gemini proxy

-- Connecting to git.thebackupbox.net:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

repo: music
action: commit
revision:
path_from:
revision_from: 5fd8dfe8fe41fd6df47d24946aceb7ebf1804ce7:
path_to:
revision_to:

git.thebackupbox.net

music

git://git.thebackupbox.net/music

commit 5fd8dfe8fe41fd6df47d24946aceb7ebf1804ce7
Author: epoch <epoch@hacking.allowed.org>
Date:   Thu Jul 30 08:25:47 2020 -0500

    pid file checks, process name check, debug info

diff --git a/music-init b/music-init

index 650e36bb379e759463fdb4dce91c66c594d5a563..

index ..a7152b11900eb4ed76a7ab20904d307c47e96b34 100755

--- a/music-init
+++ b/music-init
@@ -1,3 +1,17 @@
 #!/bin/bash
 set -o pipefail
-while true;do find -H ~/Music/ | egrep -i '\.m4a$|\.mp3$|\.flac$' | shuf;done | music-playlist
+music_init_pid="${PREFIX}/run/music/init.pid"
+while [ -f $music_init_pid ];do
+  if [ -f "${music_init_pid}" ];then
+    #pid file exists...
+    if [ "$(ps -h -o cmd -p $(cat ${PREFIX}/run/music/init.pid ))" = "qargs music-player" ];then
+      printf "already running.\n"
+      echo pid: "$(cat ${PREFIX}/run/music/init.pid)"
+      echo cmd: "$(ps -h -o cmd -p $(cat ${PREFIX}/var/run/music/init.pid))"
+      exit 1
+    fi
+    printf "stale pid file: %s\n" "${music_init_pid}"
+    rm "${music_init_pid}"
+  fi
+  find -H ~/Music/ | egrep -i '\.m4a$|\.mp3$|\.flac|\.ogg$' | shuf
+done | music-playlist

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

-- Response ended

-- Page fetched on Sun Jun 2 16:38:15 2024