This commit is contained in:
2026-03-27 18:36:38 +00:00
parent ef7eda3e62
commit 952e875248
+7 -2
View File
@@ -158,8 +158,13 @@ wait_for_rsync() {
for i in $(seq 1 "$RETRY_COUNT"); do
# stable + cross-system safe
COUNT=$(pgrep -af rsync | wc -l)
# ONLY COUNT LOCAL INITIATED RSYNC COMMANDS
COUNT=$(ps -eo pid,cmd | grep "[r]sync .*${REMOTE_SERVER:-}" | wc -l || true)
# fallback if REMOTE_SERVER not set yet
if [[ -z "$REMOTE_SERVER" ]]; then
COUNT=$(pgrep -x rsync | wc -l || true)
fi
if [[ "$COUNT" -ge "$MAX_RSYNC_PROCS" ]]; then
warn "Waiting rsync slot ($COUNT/$MAX_RSYNC_PROCS)"