Docker_Essentials echo/log audit pass — all 8 scripts + Manual

Consistent two-tier output model across the entire folder:
- Per-container banners, action lines, and list details → log (ENABLE_LOGGING=true only)
- Section headers, summaries, counts, and status conclusions → echo (always visible)
- Warnings and errors always visible regardless of log setting
- Blank echo lines inside loops removed

All scripts: added Lock Acquisition and Host Detection entries to OPERATIONAL SAFEGUARDS.

Setup banners removed from docker_watchdog.sh, docker_weekly_restart.sh,
downloaders_reset.sh (noise before any work happens).

docker_watchdog.sh: removed success "Running as root" / "Docker found" setup lines;
info() → log() for daemon-recovered and per-cycle header; removed per-cycle echo separator.

docker_update.sh + docker_update_remaining.sh: docker pull stdout suppressed when
ENABLE_LOGGING=false to prevent orphaned Status: lines appearing without container context;
restructured pull block to use PIPESTATUS for exit code capture.

downloaders_reset.sh: 11× info() → log() for all per-item API operation lines.

docker_weekly_restart.sh: removed duplicate restart-order echo (build_restart_order
already logs it internally).

Manual-Docker_Essentials.md: documented the two-tier output model and watchdog
silent-when-healthy exception in the flag reference section.
This commit is contained in:
Gmer4Lfe
2026-05-21 16:22:30 -04:00
parent e932936acc
commit 0b992a9054
9 changed files with 162 additions and 122 deletions
+8 -8
View File
@@ -68,6 +68,9 @@
# Docker Presence Check
# Verifies docker binary exists before execution.
#
# Lock Acquisition
# acquire_lock prevents overlapping runs (e.g. array_stopping firing twice).
#
# Timeout Protection
# All docker commands wrapped in timeout protection to prevent daemon hangs
# from stalling shutdown indefinitely.
@@ -167,7 +170,7 @@ echo ""
echo "━━━ $ICON_CONTAINERS Docker Container Stop — $(date '+%Y-%m-%d %H:%M:%S') ━━━"
if [[ ${#RUNNING[@]} -eq 0 ]]; then
log "No running containers — nothing to do"
echo "No running containers — nothing to do"
exit 0
fi
@@ -180,12 +183,11 @@ FAILED=()
for container in "${RUNNING[@]}"; do
[[ -z "$container" ]] && continue
echo "━━━ $ICON_CONTAINERS $container ━━━"
log "━━━ $ICON_CONTAINERS $container ━━━"
if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — would stop $container"
STOPPED+=("$container")
echo ""
continue
fi
@@ -202,7 +204,7 @@ for container in "${RUNNING[@]}"; do
-f '{{.State.Running}}' "$container" 2>/dev/null || echo "unknown")
if [[ "$STATE" != "true" ]]; then
echo "$ICON_DONE $container stopped ✅"
log "$ICON_DONE $container stopped ✅"
STOPPED+=("$container")
success=true
break
@@ -230,8 +232,6 @@ for container in "${RUNNING[@]}"; do
FAILED+=("$container")
fi
fi
echo ""
done
END=$(date +%s)
@@ -243,8 +243,8 @@ echo "━━━━━ $ICON_SUMMARY DOCKER CONTAINER STOP SUMMARY ━━━━
echo "$ICON_HOST Identity: $MY_ID ($LOCAL_SERVER_NAME)"
echo "$ICON_TIME Duration: $(format_duration $(( END - START )))"
echo "$ICON_CONTAINERS Scope: ${#RUNNING[@]} running → ${#STOPPED[@]} stopped"
[[ ${#STOPPED[@]} -gt 0 ]] && echo "$ICON_DONE Stopped: ${STOPPED[*]}"
[[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}"
[[ ${#STOPPED[@]} -gt 0 ]] && log "$ICON_DONE Stopped: ${STOPPED[*]}"
[[ ${#FAILED[@]} -gt 0 ]] && echo "$ICON_ERROR Failed: ${FAILED[*]}"
if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — no containers stopped"