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
+56 -22
View File
@@ -2,40 +2,74 @@
# ==============================================================================================
# ================================= Array Stop Orchestrator ====================================
# ==============================================================================================
# Planned shutdown orchestrator — stops all active processes cleanly before array maintenance.
# Runs ARRAY_STOP_SCRIPTS from master.conf sequentially, each confirmed complete before next.
#
# ── EXECUTION ORDER ───────────────────────────────────────────────────────────────────────────
# PURPOSE
# ─────────────────────────────────────────────────────────────────────────────
# Planned shutdown orchestrator — stops all active processes cleanly before
# array maintenance. Runs ARRAY_STOP_SCRIPTS from master.conf sequentially,
# each confirmed complete before the next starts.
#
# ==============================================================================================
# OPERATIONAL MODEL
# ==============================================================================================
#
# 1. user_scripts_stop.sh — kill background user scripts (prevents new operations)
# 2. rsync_stop.sh --rsync-only — kill rsync; skip container recovery (handled in step 4)
# 3. mover_stop.sh — stop mover after rsync (both write to same paths)
# 4. docker_container_stop.sh — stop all containers one-by-one with verification
#
# ── WHY THIS ORDER ────────────────────────────────────────────────────────────────────────────
# User scripts stopped first — they can spawn new rsync/docker operations mid-shutdown.
# Rsync before mover — both write to the same paths; running together risks corruption.
# Containers last — apps should stay available as long as possible during shutdown prep.
# Unlike array_started.sh, all scripts run in the foreground. Each must complete
# (pass or fail) before the next starts — a failed stop is noted but does not
# prevent remaining steps from running.
#
# ── SEQUENTIAL vs BACKGROUND ─────────────────────────────────────────────────────────────────
# Unlike array_started.sh, all scripts run in the foreground. Each must complete (pass or fail)
# before the next starts — a failed stop is noted but does not prevent remaining steps.
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
# ── SAFEGUARDS ────────────────────────────────────────────────────────────────────────────────
# Root check — all stop scripts require root
# acquire_lock — prevents concurrent array stop runs
# detect_hosts() — MY_ID in notifications and logs
# Order Is Load-Bearing
# User scripts are stopped first — they can spawn new rsync or docker operations
# mid-shutdown. Rsync stops before mover — both write to the same paths and
# running together risks corruption. Containers stop last — apps should stay
# available as long as possible during shutdown prep.
#
# Non-Fatal Steps
# A failed stop step is logged and notified but does not abort the sequence.
# Remaining scripts still run — a partial stop is better than a halted one.
#
# ==============================================================================================
# OPERATIONAL SAFEGUARDS
# ==============================================================================================
#
# Root check — all stop scripts require root
# acquire_lock — prevents concurrent array stop runs
# detect_hosts() — MY_ID in notifications and logs
# platform_require_cmd — notify validated before use
# Non-fatal steps — a failed step is logged but remaining steps still run
# notify on failures — alert if any stop script fails
# notify on failures — alert if any stop script fails
#
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#
# master.conf
#
# ── CONFIGURATION (master.conf) ───────────────────────────────────────────────────────────────
# ARRAY_STOP_SCRIPTS — ordered list of stop scripts to run
#
# ── USAGE ─────────────────────────────────────────────────────────────────────────────────────
# array_stopping.sh — run full stop sequence
# array_stopping.sh --dry-run — preview without stopping anything
# array_stopping.sh --status — show configured scripts and exit
# array_stopping.sh --log — verbose output
# ==============================================================================================
# RUNTIME MODES
# ==============================================================================================
#
# array_stopping.sh
# Run full stop sequence.
#
# array_stopping.sh --dry-run
# Preview without stopping anything.
#
# array_stopping.sh --status
# Show configured scripts and exit.
#
# array_stopping.sh --log
# Verbose output.
#
# ==============================================================================================
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"