Fix three image cleanup gaps: weekly restart prune, mode-aware rebuild error, monthly orphan sweep
docker_weekly_restart.sh was missing the trailing dangling prune that daily_restart has. docker_update.sh rebuild failure message always named docker_daily_restart.sh regardless of mode. docker_prune_images.sh --all added to monthly — the only scheduled path that removes tagged orphan images.
This commit is contained in:
@@ -453,6 +453,7 @@
|
|||||||
# State file on /boot/config — survives reboots (interval gate independent of uptime gate).
|
# State file on /boot/config — survives reboots (interval gate independent of uptime gate).
|
||||||
MONTHLY_MAINTENANCE_SCRIPTS=(
|
MONTHLY_MAINTENANCE_SCRIPTS=(
|
||||||
"Docker_Essentials/docker_update.sh --remainder" # update all containers not in daily/weekly managed lists
|
"Docker_Essentials/docker_update.sh --remainder" # update all containers not in daily/weekly managed lists
|
||||||
|
"Tools/docker_prune_images.sh --all" # remove stopped containers then all unused images (tagged orphans)
|
||||||
"Tools/zfs_pool_scrub.sh" # ZFS pool integrity scrub — all pools, skip ZFS_REPORT_IGNORE_POOLS
|
"Tools/zfs_pool_scrub.sh" # ZFS pool integrity scrub — all pools, skip ZFS_REPORT_IGNORE_POOLS
|
||||||
"Tools/smart_long_test.sh" # SMART extended self-test — all drives, sequential
|
"Tools/smart_long_test.sh" # SMART extended self-test — all drives, sequential
|
||||||
)
|
)
|
||||||
@@ -691,6 +692,19 @@
|
|||||||
FALLBACK_PARTNERSHIP_SUSPEND_AFTER=120 # minutes without active partnership before suspending
|
FALLBACK_PARTNERSHIP_SUSPEND_AFTER=120 # minutes without active partnership before suspending
|
||||||
# 0 = suspend immediately when partnership goes inactive
|
# 0 = suspend immediately when partnership goes inactive
|
||||||
|
|
||||||
|
# ━━━ Play State Sync ━━━
|
||||||
|
PLAY_SYNC_ENABLED=true
|
||||||
|
PLAY_SYNC_REMOTE=true # sync across hosts via Tailscale
|
||||||
|
PLAY_SYNC_DAYS=90 # days back to check for played items (0 = all time)
|
||||||
|
PLAY_SYNC_TYPES="Movie,Episode" # Audio excluded — music library too large; favorites handled separately
|
||||||
|
PLAY_SYNC_FAV_TYPES="MusicArtist,MusicAlbum,Movie,Series" # union sync — never unmarks; Audio tracks future
|
||||||
|
|
||||||
|
# ━━━ Play State Sync — Handback ━━━
|
||||||
|
# play_state_sync runs before DNS cutover so users land on current watch state.
|
||||||
|
# Retried until success — DNS is held until sync completes or retries are exhausted.
|
||||||
|
PLAY_SYNC_HANDBACK_RETRIES=5 # attempts before giving up and proceeding to DNS cutover
|
||||||
|
PLAY_SYNC_HANDBACK_RETRY_DELAY=60 # seconds between retry attempts
|
||||||
|
|
||||||
# ━━━ Failover Test ━━━
|
# ━━━ Failover Test ━━━
|
||||||
# Controlled simulation of a failover event — run manually via fallback_test.sh.
|
# Controlled simulation of a failover event — run manually via fallback_test.sh.
|
||||||
FALLBACK_TEST_BLOCK_WAIT=150 # seconds to wait after blocking connectivity
|
FALLBACK_TEST_BLOCK_WAIT=150 # seconds to wait after blocking connectivity
|
||||||
|
|||||||
@@ -397,7 +397,9 @@ if [[ ${#UPDATED[@]} -gt 0 ]]; then
|
|||||||
echo "$ICON_DONE $container rebuilt ✅"
|
echo "$ICON_DONE $container rebuilt ✅"
|
||||||
REBUILT+=("$container")
|
REBUILT+=("$container")
|
||||||
else
|
else
|
||||||
error "Failed to rebuild $container — will be picked up by docker_daily_restart.sh"
|
_fallback_msg=$([[ "$WEEKLY_MODE" == true ]] && echo "docker_weekly_restart.sh" || ([[ "$REMAINDER_MODE" == true ]] && echo "no follow-up restart" || echo "docker_daily_restart.sh"))
|
||||||
|
error "Failed to rebuild $container — $_fallback_msg"
|
||||||
|
unset _fallback_msg
|
||||||
notify "$container failed to rebuild after image update on $(hostname)" "Docker Update" "warning"
|
notify "$container failed to rebuild after image update on $(hostname)" "Docker Update" "warning"
|
||||||
REBUILD_FAILED+=("$container")
|
REBUILD_FAILED+=("$container")
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -268,6 +268,21 @@ done
|
|||||||
|
|
||||||
END=$(date +%s)
|
END=$(date +%s)
|
||||||
|
|
||||||
|
# ==============================================================================================
|
||||||
|
# ━━━ Prune Old Images ━━━
|
||||||
|
# ==============================================================================================
|
||||||
|
echo ""
|
||||||
|
echo "━━━ $ICON_SYNC Pruning Dangling Images — $(date '+%Y-%m-%d %H:%M:%S') ━━━"
|
||||||
|
|
||||||
|
if [[ "$DRY_RUN" == true ]]; then
|
||||||
|
warn "DRY RUN — would prune dangling images"
|
||||||
|
PRUNED_SUMMARY="(dry run)"
|
||||||
|
else
|
||||||
|
PRUNED_OUTPUT=$(docker image prune -f 2>&1)
|
||||||
|
[[ "$ENABLE_LOGGING" == "true" ]] && echo "$PRUNED_OUTPUT" | sed 's/^/ /'
|
||||||
|
PRUNED_SUMMARY=$(echo "$PRUNED_OUTPUT" | grep -E "^Total reclaimed" || echo "nothing reclaimed")
|
||||||
|
fi
|
||||||
|
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
# ━━━ Summary ━━━
|
# ━━━ Summary ━━━
|
||||||
# ==============================================================================================
|
# ==============================================================================================
|
||||||
@@ -280,6 +295,7 @@ if [[ ${#RESTARTED[@]} -gt 0 ]]; then
|
|||||||
fi
|
fi
|
||||||
[[ ${#SKIPPED[@]} -gt 0 ]] && log "$ICON_NOT_RUNNING Skipped: ${SKIPPED[*]} (were stopped)"
|
[[ ${#SKIPPED[@]} -gt 0 ]] && log "$ICON_NOT_RUNNING Skipped: ${SKIPPED[*]} (were stopped)"
|
||||||
[[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}"
|
[[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}"
|
||||||
|
echo "$ICON_SYNC Pruned: ${PRUNED_SUMMARY:-none}"
|
||||||
|
|
||||||
if [[ "$DRY_RUN" == true ]]; then
|
if [[ "$DRY_RUN" == true ]]; then
|
||||||
echo "$ICON_WARN Status: DRY RUN — no changes made"
|
echo "$ICON_WARN Status: DRY RUN — no changes made"
|
||||||
|
|||||||
Reference in New Issue
Block a user