refactor: rename resource_manager → resource_watchdog, RM_ → RW_

Consistent naming with the watchdog family (system_watchdog, docker_watchdog).
File renamed, all RM_ config variables and internal references updated to RW_
across master.conf, master_host1.conf, common.sh, docker_watchdog.sh,
system_watchdog.sh, watchdog_orchestrator.sh, and sunday_morning_coffee_report.sh.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gmer4Lfe
2026-05-12 18:31:09 -04:00
co-authored by Claude Sonnet 4.6
parent 309546e615
commit 9a5f6f88f2
8 changed files with 130 additions and 130 deletions
+9 -9
View File
@@ -351,10 +351,10 @@ _dr_raw=$(get_strikes "daemon_restarted_flag" "$WATCHDOG_STATE_FILE")
# 1 = RAM emergency active — defer container management this cycle
check_system_watchdog_state() {
# Returns 0 = normal operation | 1 = defer, resource_manager RAM emergency active
local state_file="$RM_STATE_FILE"
# Returns 0 = normal operation | 1 = defer, resource_watchdog RAM emergency active
local state_file="$RW_STATE_FILE"
# No state file = resource_manager not yet run — assume normal
# No state file = resource_watchdog not yet run — assume normal
[[ ! -f "$state_file" ]] && return 0
local mem_shutdown
@@ -364,7 +364,7 @@ check_system_watchdog_state() {
# ── Stale state guard ─────────────────────────────────────────────────────────────────────
# If mem_shutdown_active=true but state file hasn't been updated in > 2 hours,
# resource_manager.sh may not be running — don't defer indefinitely on stale state.
# resource_watchdog.sh may not be running — don't defer indefinitely on stale state.
local state_mtime now age_seconds stale_limit=7200 # 2 hours
state_mtime=$(stat -c %Y "$state_file" 2>/dev/null || echo 0)
now=$(date +%s)
@@ -372,7 +372,7 @@ check_system_watchdog_state() {
if [[ "$age_seconds" -gt "$stale_limit" ]]; then
warn "mem_shutdown_active=true but state file is ${age_seconds}s old — may be stale"
warn "resource_manager.sh may not be running — resuming normal container management"
warn "resource_watchdog.sh may not be running — resuming normal container management"
return 0 # Resume normal — don't defer indefinitely on stale state
fi
@@ -484,15 +484,15 @@ CYCLE_START=$(date +%s)
exit 0
fi
# ── RAM emergency check — resource_manager.sh managing containers ────────────────────────
# If resource_manager.sh has triggered a hard RAM shutdown, defer all container
# ── RAM emergency check — resource_watchdog.sh managing containers ────────────────────────
# If resource_watchdog.sh has triggered a hard RAM shutdown, defer all container
# management this run to prevent undoing the emergency stop and re-pressuring RAM.
if ! check_system_watchdog_state; then
MEM_KB=$(awk '/MemAvailable/ {print $2}' /proc/meminfo)
MEM_GB=$(( MEM_KB / 1024 / 1024 ))
warn "RAM emergency active (${MEM_GB}GB free) — resource_manager.sh managing containers"
warn "RAM emergency active (${MEM_GB}GB free) — resource_watchdog.sh managing containers"
warn "Deferring all container restart logic this run"
log "Waiting for RAM to recover above ${RM_RAM_RECOVER_GB:-20}GB before resuming"
log "Waiting for RAM to recover above ${RW_RAM_RECOVER_GB:-20}GB before resuming"
exit 0
fi