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
|
||||
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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue