Add full banner headers to all scripts across the codebase

Every script now has the established header format: PURPOSE with ─────── separator,
OPERATIONAL MODEL, DESIGN PRINCIPLES, OPERATIONAL SAFEGUARDS, CONFIGURATION, and
RUNTIME MODES — structured with full ====== banner sections throughout.

Orchestrators converted from compact ── inline format to full banners. Stale
emby-fallback and dirty sync references removed from Plugin/user_script_plug-in.sh.
This commit is contained in:
Gmer4Lfe
2026-06-26 18:50:05 -04:00
parent 1003bee72a
commit f92ee4064b
51 changed files with 1822 additions and 563 deletions
+65 -35
View File
@@ -2,56 +2,86 @@
# ==============================================================================================
# =========================== Intermediate Sync Maintenance ====================================
# ==============================================================================================
# 4-hour orchestrator — arr library reconciliation, artwork fetching, and optional rsync.
# Schedule: 0 */4 * * * (every 4 hours)
#
# ── EXECUTION ORDER ───────────────────────────────────────────────────────────────────────────
# 1. conf_sync.sh --pull-only — refresh partner conf cache in RAM (/tmp/.cache/vv/d/)
# 2. arr_sync.sh — sync Lidarr/Sonarr/Radarr libraries across all nodes
# 3. Rsync window (optional) — INTERMEDIATE_SYNC_SHARES, if any configured
# 4. INTERMEDIATE_MAINTENANCE_SCRIPTS — artwork fetch and any future 4-hour jobs
# PURPOSE
# ─────────────────────────────────────────────────────────────────────────────
# 4-hour orchestrator — arr library reconciliation, artwork fetching, and
# optional rsync. Schedule: 0 */4 * * * (every 4 hours)
#
# ── WHY A SEPARATE ORCHESTRATOR ───────────────────────────────────────────────────────────────
# arr libraries need to converge more frequently than once a day. If a remote node adds
# something at 2am, the next daily window is 23 hours away — remote arrs search for content
# they don't know is already owned. Running every 4 hours closes that gap.
# ==============================================================================================
# OPERATIONAL MODEL
# ==============================================================================================
#
# lidarr_missing_art.sh is idempotent — skips existing files, runs fast after initial fill.
# Pairing it here means artwork catches up within 4 hours of a new album landing.
# 1. conf_sync.sh --pull-only — refresh partner conf cache in RAM (/tmp/.cache/vv/d/)
# 2. arr_sync.sh — sync Lidarr/Sonarr/Radarr libraries across all nodes
# 3. Rsync window (optional) — INTERMEDIATE_SYNC_SHARES, if any configured
# 4. INTERMEDIATE_MAINTENANCE_SCRIPTS — artwork fetch and any future 4-hour jobs
#
# Rsync is optional — INTERMEDIATE_SYNC_SHARES empty by default. Add shares to the config
# if a subset of data needs mid-day propagation (e.g. watch state, metadata). Full media
# share sync stays in the daily window.
# DRIVE TEMP HANDLING (rsync.sh exit codes):
# exit 1 = temp WARN → skip this share, continue to next
# exit 2 = temp CRITICAL → abort ALL remaining syncs in this window
#
# ── HOST AWARENESS ────────────────────────────────────────────────────────────────────────────
# detect_hosts() sets MY_ID and aliases HOST*_INTERMEDIATE_SYNC_SHARES → INTERMEDIATE_SYNC_SHARES.
# Each server can have a different set of mid-day shares — configure in host*.conf.
# Each script in INTERMEDIATE_MAINTENANCE_SCRIPTS handles its own host logic.
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
# ── DRIVE TEMP HANDLING ───────────────────────────────────────────────────────────────────────
# Same as daily_sync_maintenance.sh:
# exit 1 = temp WARN — skip this share, continue to next
# exit 2 = temp CRITICAL — abort ALL remaining syncs in this window
# Closes the Library Gap
# Arr libraries need to converge more frequently than once a day. If a remote
# node adds something at 2am, the next daily window is 23 hours away — remote
# arrs search for content they don't know is already owned. Running every 4
# hours closes that gap.
#
# Idempotent Artwork
# lidarr_missing_art.sh skips existing files and runs fast after initial fill.
# Pairing it here means artwork catches up within 4 hours of a new album landing.
#
# Optional Rsync Layer
# INTERMEDIATE_SYNC_SHARES is empty by default — the rsync step is skipped
# entirely when nothing is configured. Add shares only if a subset of data
# needs mid-day propagation. Full media share sync stays in the daily window.
#
# ==============================================================================================
# OPERATIONAL SAFEGUARDS
# ==============================================================================================
#
# ── SAFEGUARDS ────────────────────────────────────────────────────────────────────────────────
# Root check — scripts called here require root
# acquire_lock — prevents concurrent intermediate windows
# detect_hosts() — aliases correct per-host share lists
# check_connectivity — verified before any rsync (skipped if no shares)
# check_remote_rootfs — aborts rsync if remote rootfs nearly full
# Non-fatal jobs — a failed arr_sync warns but does not block rsync or artwork fetch
# Silent on success — runs 4x/day, only failures warrant notification
#
# ── CONFIGURATION ─────────────────────────────────────────────────────────────────────────────
# host*.conf: HOST*_INTERMEDIATE_SYNC_SHARES — shares synced mid-day (empty = rsync skipped)
# master.conf: INTERMEDIATE_RSYNC_ENABLED — enable/disable rsync section (default: true)
# master.conf: INTERMEDIATE_MAINTENANCE_SCRIPTS — jobs run after rsync
# master.conf: ARR_SYNC_ENABLED — toggle inside arr_sync.sh
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#
# host*.conf
#
# HOST*_INTERMEDIATE_SYNC_SHARES — shares synced mid-day (empty = rsync skipped)
#
# master.conf
#
# INTERMEDIATE_RSYNC_ENABLED — enable/disable rsync section (default: true)
# INTERMEDIATE_MAINTENANCE_SCRIPTS — jobs run after rsync
# ARR_SYNC_ENABLED — toggle inside arr_sync.sh
#
# ==============================================================================================
# RUNTIME MODES
# ==============================================================================================
#
# intermediate_sync_maintenance.sh
# Normal run.
#
# intermediate_sync_maintenance.sh --dry-run
# Preview without changes.
#
# intermediate_sync_maintenance.sh --log
# Verbose per-job output.
#
# intermediate_sync_maintenance.sh --status
# Show configured shares/jobs and exit.
#
# ── USAGE ─────────────────────────────────────────────────────────────────────────────────────
# intermediate_sync_maintenance.sh — normal run
# intermediate_sync_maintenance.sh --dry-run — preview without changes
# intermediate_sync_maintenance.sh --log — verbose per-job output
# intermediate_sync_maintenance.sh --status — show configured shares/jobs and exit
# ==============================================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"