big logic update to rsync and rsync called scripts

This commit is contained in:
2026-04-28 17:04:09 -04:00
parent f7074cfba0
commit 11872b802b
6 changed files with 1718 additions and 50 deletions
+30 -5
View File
@@ -17,6 +17,10 @@
# 9. radarr_cleanup.sh — remove orphaned movie files
# 10. docker_daily_restart.sh — restart containers that need daily restart
#
# What triggers weekly_health_digest.sh:
# NOT this script — weekly_health_digest.sh runs on its own schedule (Saturday)
# This script writes no stats — it just syncs and maintains
#
# Configuration in Master.conf:
# DAILY_MAINTENANCE_SCRIPTS — pre/post-sync scripts (git pull, docker restart)
# MEDIA_MANAGEMENT_JOBS — media maintenance jobs run after sync
@@ -144,6 +148,8 @@ echo ""
SHARE_INDEX=0
ABORT_ALL_SYNCS=false
for SHARE in "${ALL_SHARES[@]}"; do
SHARE_INDEX=$((SHARE_INDEX + 1))
SHARE_NAME=$(basename "$SHARE")
@@ -151,14 +157,33 @@ for SHARE in "${ALL_SHARES[@]}"; do
echo "━━━ $ICON_SYNC Share $SHARE_INDEX of $SHARE_COUNT: $SHARE_NAME ━━━"
if bash "$RSYNC_SCRIPT" "$SHARE"; then
SHARE_END=$(date +%s)
SHARE_TIMES+=("$SHARE_NAME:$((SHARE_END - SHARE_START))")
if [[ "$ABORT_ALL_SYNCS" == true ]]; then
warn "$SHARE_NAME — skipped (drive temps CRITICAL earlier in window)"
FAIL+=("$SHARE_NAME:temp-critical")
echo ""
continue
fi
bash "$RSYNC_SCRIPT" "$SHARE"
RSYNC_EXIT=$?
SHARE_END=$(date +%s)
SHARE_TIMES+=("$SHARE_NAME:$((SHARE_END - SHARE_START))")
if [[ "$RSYNC_EXIT" -eq 0 ]]; then
PASS+=("$SHARE_NAME")
echo "$ICON_DONE $SHARE_NAME complete"
elif [[ "$RSYNC_EXIT" -eq 1 ]]; then
# Temp warning — skip this profile, continue to next
FAIL+=("$SHARE_NAME:temp-warn")
warn "$SHARE_NAME skipped — drive temps too high"
elif [[ "$RSYNC_EXIT" -eq 2 ]]; then
# Temp critical — abort all remaining syncs
FAIL+=("$SHARE_NAME:temp-critical")
ABORT_ALL_SYNCS=true
error "$SHARE_NAME aborted — drive temps CRITICAL, stopping all remaining syncs"
notify "Daily sync aborted on $(hostname) — drive temps CRITICAL during $SHARE_NAME sync" "Daily Sync" "warning"
else
SHARE_END=$(date +%s)
SHARE_TIMES+=("$SHARE_NAME:$((SHARE_END - SHARE_START))")
FAIL+=("$SHARE_NAME")
error "$SHARE_NAME failed — continuing to next share"
fi