This commit is contained in:
Sebastian
2025-03-21 06:10:27 +01:00
parent 907c90297d
commit d9c65cb01a

View File

@@ -9,8 +9,33 @@ IFS=':' read -ra parts <<< $COMPOSE_FILE
blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml" "ftp.yml" "backup-http.yml") blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml" "ftp.yml" "backup-http.yml")
# Flag to track if any invocation failed # Flag to track if any invocation failed
any_failure=false any_failure=false
# Function to run the command and handle the result
check_sync_status() {
local part=$1
result=$("$BASEPATH/sync-status.sh" "${part%.yml}")
if [ $? -ne 0 ]; then
if [[ "$result" == *"syncing"* ]]; then
# Allow exit status 1 if result contains "syncing"
return 0
elif [[ "$result" == *"lagging"* ]]; then
# Allow exit status 1 if result contains "lagging"
return 0
else
any_failure=true
return 1
fi
fi
echo "${part%.yml}: $result"
return 0
}
for part in "${parts[@]}"; do for part in "${parts[@]}"; do
include=true include=true
for word in "${blacklist[@]}"; do for word in "${blacklist[@]}"; do
@@ -33,25 +58,17 @@ for part in "${parts[@]}"; do
fi fi
if $include; then if $include; then
result=$($BASEPATH/sync-status.sh "${part%.yml}") check_sync_status "$part" &
pids+=($!) # Save the process ID for waiting later
if [ $? -ne 0 ]; then
if [[ "$result" == *"syncing"* ]]; then
# Allow exit status 1 if result contains "syncing"
true
elif [[ "$result" == *"lagging"* ]]; then
# Allow exit status 1 if result contains "syncing"
true
else
any_failure=true
fi
fi
echo "${part%.yml}: $result"
fi fi
done done
# Wait for all background processes to finish
for pid in "${pids[@]}"; do
wait "$pid"
done
# If any invocation failed, return a failure exit code # If any invocation failed, return a failure exit code
if $any_failure; then if $any_failure; then
exit 1 exit 1
fi fii