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:
@@ -2,39 +2,86 @@
|
||||
# ==============================================================================================
|
||||
# ========================= Monthly Maintenance Orchestrator ===================================
|
||||
# ==============================================================================================
|
||||
# Uptime-triggered monthly maintenance — runs heavy tasks that need a stable, settled system.
|
||||
#
|
||||
# PURPOSE
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# Uptime-triggered monthly maintenance — runs heavy tasks that need a stable,
|
||||
# settled system. Schedule: 0 0 15 * * (15th of each month at midnight)
|
||||
# Fires only when BOTH gates pass:
|
||||
# 1. Server uptime >= MONTHLY_UPTIME_THRESHOLD_DAYS days
|
||||
# 2. Last run was >= MONTHLY_RUN_INTERVAL_DAYS days ago (or never run)
|
||||
#
|
||||
# ── WHY UPTIME-GATED ─────────────────────────────────────────────────────────────────────────
|
||||
# A scheduled reboot resets uptime. Monthly tasks (ZFS scrub, SMART long test) need a
|
||||
# stable, settled system — not one that just rebooted. Uptime-gating ensures maintenance
|
||||
# only runs after the server has been healthy for a full month, never immediately post-boot.
|
||||
# If uptime or interval gate is not met on the 15th, the run is skipped until next month.
|
||||
# ==============================================================================================
|
||||
# OPERATIONAL MODEL
|
||||
# ==============================================================================================
|
||||
#
|
||||
# ── HOW TO CALL ──────────────────────────────────────────────────────────────────────────────
|
||||
# Schedule: 0 0 15 * * (15th of each month at midnight)
|
||||
# Silent exit 0 when either gate is not met. Only outputs when maintenance actually fires.
|
||||
# Runs MONTHLY_MAINTENANCE_SCRIPTS sequentially when both gates pass.
|
||||
# Silent exit 0 when either gate is not met — only outputs when maintenance fires.
|
||||
# If uptime or interval gate is not met on the 15th, the run is skipped until
|
||||
# next month.
|
||||
#
|
||||
# ── STATE FILE ────────────────────────────────────────────────────────────────────────────────
|
||||
# MONTHLY_LAST_RUN_FILE — /boot/config — survives reboots, available before array starts.
|
||||
# Written after each run (pass or partial fail). Format: Unix timestamp.
|
||||
# A reboot does NOT reset the last-run state — the interval gate survives independently
|
||||
# of the uptime gate. Both must pass before maintenance fires again.
|
||||
# STATE FILE
|
||||
# MONTHLY_LAST_RUN_FILE lives on /boot/config — survives reboots, available
|
||||
# before the array starts. Written after each run (pass or partial fail).
|
||||
# Format: Unix timestamp. A reboot does NOT reset the last-run state — the
|
||||
# interval gate survives independently of the uptime gate.
|
||||
#
|
||||
# ==============================================================================================
|
||||
# DESIGN PRINCIPLES
|
||||
# ==============================================================================================
|
||||
#
|
||||
# Uptime Gate Ensures Stability
|
||||
# A scheduled reboot resets uptime. Monthly tasks (ZFS scrub, SMART long test)
|
||||
# need a stable, settled system — not one that just rebooted. Both gates must
|
||||
# pass before maintenance fires, ensuring the server has been healthy for a
|
||||
# full month.
|
||||
#
|
||||
# State Survives Reboots
|
||||
# MONTHLY_LAST_RUN_FILE is on /boot/config (USB flash), not on the array.
|
||||
# It is always available regardless of array state, so the interval gate is
|
||||
# never lost to a reboot.
|
||||
#
|
||||
# ==============================================================================================
|
||||
# OPERATIONAL SAFEGUARDS
|
||||
# ==============================================================================================
|
||||
#
|
||||
# Root check — ZFS scrub, SMART tests require root
|
||||
# acquire_lock — prevents concurrent monthly runs
|
||||
# detect_hosts() — MY_ID in notifications and logs
|
||||
# Uptime gate — MONTHLY_UPTIME_THRESHOLD_DAYS must be met
|
||||
# Interval gate — MONTHLY_RUN_INTERVAL_DAYS since last run must be met
|
||||
# --force flag — bypasses both gates for manual override
|
||||
#
|
||||
# ==============================================================================================
|
||||
# CONFIGURATION
|
||||
# ==============================================================================================
|
||||
#
|
||||
# master.conf
|
||||
#
|
||||
# ── CONFIGURATION (master.conf) ───────────────────────────────────────────────────────────────
|
||||
# MONTHLY_MAINTENANCE_SCRIPTS — ordered list of scripts to run
|
||||
# MONTHLY_UPTIME_THRESHOLD_DAYS — minimum uptime in days before maintenance fires
|
||||
# MONTHLY_RUN_INTERVAL_DAYS — minimum days since last run before running again
|
||||
# MONTHLY_LAST_RUN_FILE — state file path — /boot/config, survives reboots
|
||||
# MONTHLY_LAST_RUN_FILE — state file path (/boot/config — survives reboots)
|
||||
#
|
||||
# ==============================================================================================
|
||||
# RUNTIME MODES
|
||||
# ==============================================================================================
|
||||
#
|
||||
# monthly_maintenance.sh
|
||||
# Normal run — uptime + interval gates enforced.
|
||||
#
|
||||
# monthly_maintenance.sh --dry-run
|
||||
# Preview gate state and scripts without running.
|
||||
#
|
||||
# monthly_maintenance.sh --status
|
||||
# Show gate state, last run, and configured scripts.
|
||||
#
|
||||
# monthly_maintenance.sh --force
|
||||
# Bypass uptime + interval gates (manual override).
|
||||
#
|
||||
# monthly_maintenance.sh --log
|
||||
# Verbose output.
|
||||
#
|
||||
# ── USAGE ─────────────────────────────────────────────────────────────────────────────────────
|
||||
# monthly_maintenance.sh — normal run (uptime + interval gates enforced)
|
||||
# monthly_maintenance.sh --dry-run — preview gate state and scripts without running
|
||||
# monthly_maintenance.sh --status — show gate state, last run, and configured scripts
|
||||
# monthly_maintenance.sh --force — bypass uptime + interval gates (manual override)
|
||||
# monthly_maintenance.sh --log — verbose output
|
||||
# ==============================================================================================
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
Reference in New Issue
Block a user