Bring script headers onto the template and close safeguard gaps

Headers claimed protections the code never had, and several destructive paths had no
guard against a collapsed config value.
This commit is contained in:
Gmer4Lfe
2026-08-01 20:37:59 -04:00
parent cdce877601
commit e8b114094a
78 changed files with 3301 additions and 277 deletions
+54
View File
@@ -40,6 +40,35 @@
# If remote unreachable → skips remote cleanly, logs warning.
#
# ==============================================================================================
# DESIGN PRINCIPLES
# ==============================================================================================
#
# Stop the Transfer, Not the Schedule
# The default mode kills only the rsync subprocess and lets the orchestrator notice
# the exit and wind down on its own. Killing the orchestrator too would abandon the
# remaining shares silently; letting it finish its own loop keeps the schedule honest
# about what ran and what did not.
#
# Exact-Name Process Matching
# Targets are found with pgrep -x rsync — exact process name, never a pattern match
# against a command line. A loose pattern on a box running arbitrary containers could
# match something that merely mentions rsync in its arguments.
#
# Liveness Checked Before Every Signal
# kill -0 confirms a PID is still alive immediately before signalling it. PIDs are
# reused, and a transfer that exited on its own between discovery and signalling must
# not have its number sent a kill.
#
# Interrupting Is Safe by Construction
# rsync runs with --partial, so a killed transfer resumes rather than restarting.
# That is what makes stopping mid-sync a routine operation rather than a costly one.
#
# Clean Up What the Interruption Left
# A killed rsync leaves its lock file behind and may leave profile containers stopped.
# Both are cleared afterwards, so the next scheduled run is not blocked by a lock
# whose owner no longer exists.
#
# ==============================================================================================
# OPERATIONAL SAFEGUARDS
# ==============================================================================================
#
@@ -61,6 +90,31 @@
# Remote containers deferred to docker_watchdog.sh.
#
# ==============================================================================================
# CONFIGURATION
# ==============================================================================================
#
# master.conf
#
# LOCK_DIR
# Directory holding rsync and orchestrator lock files. Scanned after a kill to
# clear locks whose owning PID is gone.
#
# DOCKER_TIMEOUT
# Timeout applied to the docker calls used when recovering containers a killed
# rsync left stopped.
#
# PROFILE_CRITICAL_CONTAINER_NAMES
# Per-profile container lists — used to work out which containers an interrupted
# profile sync had stopped and therefore needs restarting.
#
# SSH_KEY / SSH timeouts
# Used to reach the partner when stopping its rsync as well.
#
# host*.conf
#
# HOST* — resolved via detect_hosts() for MY_ID and remote routing
#
# ==============================================================================================
# RUNTIME MODES
# ==============================================================================================
#