added manual neuclear option to arrs cleanup

This commit is contained in:
2026-04-26 01:05:22 -04:00
parent f826672b80
commit 3df4542351
11 changed files with 988 additions and 97 deletions
+34 -27
View File
@@ -1,38 +1,45 @@
#!/bin/bash
# -----------------------------------------------------------------------------------------------
# ----------------------------- Weekly Sync Maintenance ------------------------------------
# ----------------------------- Weekly Sync Maintenance ----------------------------------------
# -----------------------------------------------------------------------------------------------
# Maintenance window orchestrator for Emby and the auth stack (Critical-Data).
# Both local and remote containers are stopped for the entire window — clean state
# guaranteed for sync, updates, and restart.
# Weekly maintenance window orchestrator — clean sync, container updates, weekly restarts.
# Schedule: 30 2 * * 0 (Sunday 2:30am — fits before 3am network reboot)
#
# What it does (in order):
# 1. Stop local containers auth stack + Emby stopped locally
# 2. Stop remote containers auth stack + Emby stopped remotely via SSH
# 3. Pull updates locally — if CRITICAL_SYNC_UPDATES=true
# 4. Pull updates remotely — if CRITICAL_SYNC_UPDATES_REMOTE=true
# 5. rsync Emby — clean full sync, both sides down
# 6. rsync Critical-Data — clean full sync, databases fully flushed
# 7. Start remote containers — starts on new images, correct order
# 8. Start local containers — starts on new images, correct order
# Execution order:
# 1. Stop local containers — Emby + auth stack stopped locally
# 2. Stop remote containers — Emby + auth stack stopped remotely via SSH
# 3. Pull updates locally — if CRITICAL_SYNC_UPDATES=true
# 4. Pull updates remotely — if CRITICAL_SYNC_UPDATES_REMOTE=true
# 5. rsync Emby — full clean mirror, both instances stopped
# 6. rsync Critical-Data — auth stack clean sync, databases flushed
# 7. Start remote containers — correct order, delayed start respected
# 8. Start local containers — correct order, delayed start respected
# 9. docker_weekly_restart.sh — weekly container restarts
#
# Why this is better than separate update + sync jobs:
# Containers are already stopped for the sync — no extra downtime for updates
# Both sides on identical image versions after restart
# Databases synced before first start on new version — clean state guaranteed
# One maintenance window handles sync + updates + ordered restart
# Synced shares (WEEKLY_SYNC_JOBS in Master.conf):
# /mnt/user/Media_Server/Emby — emby profile — full mirror, cache resets weekly
# /mnt/user/appdata-Failover/Critical-Data — critical-data — auth stack clean state
#
# Toggle updates on/off in Master.conf:
# CRITICAL_SYNC_UPDATES=true/false — local updates
# CRITICAL_SYNC_UPDATES_REMOTE=true/false — remote updates
# Both false = sync only (sync only, no updates)
# Why weekly instead of nightly for Emby:
# Emby builds a warm image cache on HOST2 throughout the week
# Syncing nightly resets cache — cold loads every morning for users
# Weekly sync: cache stays warm 6 days, resets Sunday night while users sleep
# emby-failover dirty sync covers watch states + library every 30-60min between syncs
#
# Container lists and startup order from PROFILE_CRITICAL_CONTAINER_NAMES
# Delayed containers (Authelia, Authelia-Secondary) respected on restart
# Containers not found on a server skipped gracefully
# Only containers that were running get restarted — stopped containers stay stopped
# Container updates during the window:
# Containers already stopped for sync — updates pull at zero extra downtime
# Both servers start on identical image versions after the window completes
# Toggle: CRITICAL_SYNC_UPDATES / CRITICAL_SYNC_UPDATES_REMOTE in Master.conf
#
# Recommended schedule: 30 2 * * 0 (Sunday 2:30am)
# What triggers weekly_health_digest.sh:
# NOT this script — weekly_health_digest.sh runs on its own Saturday schedule
#
# Configuration in Master.conf:
# WEEKLY_SYNC_JOBS — shares synced during the maintenance window
# WEEKLY_MAINTENANCE_SCRIPTS — scripts run after sync (docker_weekly_restart)
# CRITICAL_SYNC_UPDATES — toggle container updates on/off
# CRITICAL_SYNC_UPDATES_REMOTE — toggle remote container updates on/off
# -----------------------------------------------------------------------------------------------
# All configuration in Master.conf.
# Supports --dry-run to walk through without stopping containers, syncing, or updating.
# -----------------------------------------------------------------------------------------------