From bb748741cd97031a25e39ec8fc884abf46d1ec9a Mon Sep 17 00:00:00 2001 From: sascha Date: Sun, 6 Sep 2026 10:10:37 +0200 Subject: [PATCH] =?UTF-8?q?fix(movetdarr.sh):=20BusyBox=20flock=20hat=20ke?= =?UTF-8?q?in=20-w=20(timeout)=20=E2=86=92=20-n=20+=20Retry-Loop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BusyBox flock kennt nur -n (non-blocking), nicht -w/--timeout. Der alte Code 'flock -w 900' schlug fehl → Skript fiel sofort in 'fahre ohne Lock fort' und lief ohne Race-Schutz. Fix: -n mit 900s Retry-Loop (1s Intervall) = effektiv 15min Timeout. Der Lock wird jettt korrekt gesetzt, parallele Downloads sind serialisiert. --- usenet-scripts/movetdarr.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/usenet-scripts/movetdarr.sh b/usenet-scripts/movetdarr.sh index 8671483..4e8024f 100644 --- a/usenet-scripts/movetdarr.sh +++ b/usenet-scripts/movetdarr.sh @@ -145,14 +145,19 @@ register_lease() { } if command -v flock >/dev/null 2>&1; then - flock -w 900 "$LEASE_LOCK" -c 'set -e' || true # Lock-Datei anlegen - exec 9>"$LEASE_LOCK" - if ! flock -w 900 9; then + # BusyBox flock hat kein -w (timeout) → -n (non-blocking) mit Retry-Loop + LEASE_ACQUIRED=false + for i in $(seq 1 900); do + if flock -n "$LEASE_LOCK" -c true 2>/dev/null; then + LEASE_ACQUIRED=true + break + fi + sleep 1 + done + if [ "$LEASE_ACQUIRED" != "true" ]; then log "WARNUNG: Lease-Lock nach 15 Minuten nicht erhalten; fahre ohne Lock fort" - register_lease - else - register_lease fi + register_lease else register_lease fi