fix(movetdarr.sh): BusyBox flock hat kein -w (timeout) → -n + Retry-Loop
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.
This commit is contained in:
parent
e8a36502e9
commit
bb748741cd
1 changed files with 11 additions and 6 deletions
|
|
@ -145,14 +145,19 @@ register_lease() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if command -v flock >/dev/null 2>&1; then
|
if command -v flock >/dev/null 2>&1; then
|
||||||
flock -w 900 "$LEASE_LOCK" -c 'set -e' || true # Lock-Datei anlegen
|
# BusyBox flock hat kein -w (timeout) → -n (non-blocking) mit Retry-Loop
|
||||||
exec 9>"$LEASE_LOCK"
|
LEASE_ACQUIRED=false
|
||||||
if ! flock -w 900 9; then
|
for i in $(seq 1 900); do
|
||||||
log "WARNUNG: Lease-Lock nach 15 Minuten nicht erhalten; fahre ohne Lock fort"
|
if flock -n "$LEASE_LOCK" -c true 2>/dev/null; then
|
||||||
register_lease
|
LEASE_ACQUIRED=true
|
||||||
else
|
break
|
||||||
register_lease
|
|
||||||
fi
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
if [ "$LEASE_ACQUIRED" != "true" ]; then
|
||||||
|
log "WARNUNG: Lease-Lock nach 15 Minuten nicht erhalten; fahre ohne Lock fort"
|
||||||
|
fi
|
||||||
|
register_lease
|
||||||
else
|
else
|
||||||
register_lease
|
register_lease
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue