Add verbose log() coverage across Docker_Essentials, unRAID_Essentials, Transcodes, and Orchestrators

- Config/threshold dumps at startup in every script (retry counts, timeouts, sizes, thresholds)
- Per-item detail in verbose: container images, timing per container/share/job, image ID diffs
- Orchestrators: watchdog cycle now logs array state, grace state, per-script timing; transcode_management shows ramdisk state before each cycle; critical_sync logs share list and maintenance scripts; coffee report logs server state at run time
- Summary counts replaced with names in verbose where previously only counts were shown

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gmer4Lfe
2026-06-01 20:51:34 -04:00
co-authored by Claude Sonnet 4.6
parent 8f696d85f7
commit bc70ebe5ee
18 changed files with 126 additions and 23 deletions
@@ -119,6 +119,10 @@ RSYNC_OK=false
PASS=()
FAIL=()
log "$ICON_SYNC Critical shares (${#CRITICAL_SYNC_SHARES[@]}): $(for s in "${CRITICAL_SYNC_SHARES[@]}"; do printf '%s ' "$(basename "${s%%|*}")"; done)"
[[ ${#CRITICAL_MAINTENANCE_SCRIPTS[@]} -gt 0 ]] && \
log "$ICON_GEAR Maintenance scripts: $(for s in "${CRITICAL_MAINTENANCE_SCRIPTS[@]}"; do printf '%s ' "$(basename "${s%% *}")"; done)"
if ! check_rsync_enabled "CRITICAL"; then
echo "Critical rsync disabled — skipping sync, running partnership check only"
elif [[ ${#CRITICAL_SYNC_SHARES[@]} -eq 0 ]]; then
@@ -87,11 +87,21 @@ fi
# ==============================================================================================
# ━━━ Main ━━━
# ==============================================================================================
_unraid_ver=$(grep -oP '(?<=version=")[^"]+' /etc/unraid-version 2>/dev/null || echo "unknown")
_uptime_s=$(awk '{print int($1)}' /proc/uptime 2>/dev/null || echo 0)
_container_count=$(docker ps -q 2>/dev/null | wc -l || echo 0)
_rootfs_pct=$(df / --output=pcent 2>/dev/null | tail -1 | tr -d ' %')
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "☕ Sunday Morning Coffee Report — $MY_ID"
[[ "$DRY_RUN" == true ]] && echo " [DRY RUN]"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
log "$ICON_HOST Server: $MY_ID ($LOCAL_SERVER_NAME) — unRAID $_unraid_ver"
log "$ICON_TIME Uptime: $(format_duration $_uptime_s)"
log "$ICON_CONTAINERS Docker: $_container_count container(s) running"
log "$ICON_HEALTH Rootfs: ${_rootfs_pct:-?}% used"
log "$ICON_GEAR Scripts: ${#COFFEE_REPORT_SCRIPTS[@]} configured"
if [[ ${#COFFEE_REPORT_SCRIPTS[@]} -eq 0 ]]; then
warn "No scripts configured — add entries to COFFEE_REPORT_SCRIPTS in master.conf"
+18
View File
@@ -137,22 +137,40 @@ if [[ ! -f "$MANAGER_SCRIPT" ]]; then
exit 1
fi
# ==============================================================================================
# ━━━ Pre-run State Snapshot ━━━
# ==============================================================================================
if mountpoint -q "${RAMDISK_PATH:-}" 2>/dev/null; then
_rd_used=$(df "$RAMDISK_PATH" --output=used 2>/dev/null | tail -1 | tr -d ' ')
_rd_avail=$(df "$RAMDISK_PATH" --output=avail 2>/dev/null | tail -1 | tr -d ' ')
_rd_used_gb=$(awk "BEGIN {printf \"%.2f\", ${_rd_used:-0}/1048576}")
_rd_avail_gb=$(awk "BEGIN {printf \"%.2f\", ${_rd_avail:-0}/1048576}")
_rd_target=$(readlink "${TRANSCODE_LINK:-}" 2>/dev/null || echo "unknown")
log "$ICON_RAM Ramdisk: ${_rd_used_gb}GB used / ${_rd_avail_gb}GB avail — symlink → ${_rd_target##*/}"
else
log "$ICON_RAM Ramdisk: not mounted"
fi
# ==============================================================================================
# ━━━ Run Cleanup ━━━
# ==============================================================================================
DRY_FLAG=""
[[ "$DRY_RUN" == true ]] && DRY_FLAG="--dry-run"
_cleanup_start=$(date +%s)
bash "$CLEANUP_SCRIPT" $DRY_FLAG
CLEANUP_EXIT=$?
log "cleanup: $(format_duration $(( $(date +%s) - _cleanup_start ))) (exit $CLEANUP_EXIT)"
# ==============================================================================================
# ━━━ Run Manager ━━━
# ==============================================================================================
# transcode_manager.sh writes to TRANSCODE_DAILY_LOG after each run
# No --no-log flag here — manager owns the log write for this cycle ✅
_manager_start=$(date +%s)
bash "$MANAGER_SCRIPT" $DRY_FLAG
MANAGER_EXIT=$?
log "manager: $(format_duration $(( $(date +%s) - _manager_start ))) (exit $MANAGER_EXIT)"
# ==============================================================================================
# ━━━ Exit ━━━
+9 -1
View File
@@ -68,6 +68,9 @@ acquire_lock
detect_hosts
log "$ICON_GEAR Config: grace=${WATCHDOG_STARTUP_GRACE}s heartbeat=${WATCHDOG_ORCHESTRATOR_HEARTBEAT:-true}/${WATCHDOG_ORCHESTRATOR_HEARTBEAT_HOURS:-1}hr scripts=${#WATCHDOG_ORCHESTRATOR_SCRIPTS[@]}"
log "$ICON_WATCHDOG Order: $(for s in "${WATCHDOG_ORCHESTRATOR_SCRIPTS[@]}"; do printf '%s ' "${s##*/}"; done)"
[[ "$DRY_RUN" == true ]] && warn "DRY RUN — passing --dry-run to all sub-scripts"
# Derive a display name from a script path: "resource_watchdog.sh" → "Resource Watchdog"
@@ -122,6 +125,7 @@ if ! df --output=fstype /mnt/user 2>/dev/null | grep -q shfs; then
echo "Array not started — skipping watchdog cycle"
exit 0
fi
log "$ICON_DISK Array: /mnt/user mounted (shfs) ✅"
# ==============================================================================================
# ━━━ Startup Grace ━━━
@@ -131,6 +135,7 @@ if [[ "$UPTIME_SECONDS" -lt "$WATCHDOG_STARTUP_GRACE" ]]; then
echo "Startup grace — $(format_duration $UPTIME_SECONDS) / $(format_duration $WATCHDOG_STARTUP_GRACE) — skipping cycle"
exit 0
fi
log "Startup grace: past — uptime $(format_duration $UPTIME_SECONDS)"
# ==============================================================================================
# ━━━ Run Watchdog Cycle ━━━
@@ -154,12 +159,15 @@ run_watchdog() {
[[ "$DRY_RUN" == true ]] && extra_args+=("--dry-run")
[[ "$VERBOSE" == true ]] && extra_args+=("--log")
local _ws
_ws=$(date +%s)
log "$ICON_START $name"
if bash "$script" "${extra_args[@]}"; then
log "$ICON_DONE $name — done in $(format_duration $(( $(date +%s) - _ws )))"
PASS+=("$name")
return 0
else
error "$name — non-zero exit"
error "$name — non-zero exit ($(format_duration $(( $(date +%s) - _ws ))))"
FAIL+=("$name")
return 1
fi