audit echo vs log across all scripts — outcomes always visible, verbose for per-item loops

This commit is contained in:
Gmer4Lfe
2026-06-14 12:40:15 -04:00
parent 4c37ab16fd
commit 3964f6fb46
1010 changed files with 377767 additions and 132 deletions
+1 -1
View File
@@ -184,7 +184,7 @@ for share_path in "${PARSED_ARGS[@]}"; do
-exec chmod "${PERMISSIONS_FILE_MODE:-664}" {} + 2>/dev/null || CHMOD_FILE_OK=false
if [[ "$CHOWN_OK" == true && "$CHMOD_DIR_OK" == true && "$CHMOD_FILE_OK" == true ]]; then
log "$ICON_UNLOCKED $(basename "$share_path") — permissions applied ✅"
echo "$ICON_UNLOCKED $(basename "$share_path") — permissions applied ✅"
PASS+=("$(basename "$share_path")")
else
error "$(basename "$share_path") — repair failed"
+5 -5
View File
@@ -175,7 +175,7 @@ case "$STATUS" in
log "Stopping $CONTAINER_NAME for clean export..."
if [[ "$DRY_RUN" == false ]]; then
if timeout "$DOCKER_TIMEOUT" docker stop "$CONTAINER_NAME" >/dev/null 2>&1; then
log "$CONTAINER_NAME stopped ✅"
echo "$CONTAINER_NAME stopped ✅"
else
error "Failed to stop $CONTAINER_NAME — aborting export"
exit 1
@@ -185,7 +185,7 @@ case "$STATUS" in
fi
;;
false)
log "$CONTAINER_NAME is not running — archiving as-is (was stopped state respected)"
echo "$CONTAINER_NAME is not running — archiving as-is (was stopped state respected)"
;;
"")
error "$CONTAINER_NAME not found — check container name"
@@ -224,7 +224,7 @@ if [[ "$DRY_RUN" == false ]]; then
log "Verifying archive..."
if tar --test-label -f "$ARCHIVE_PATH" 2>/dev/null || \
tar -tzf "$ARCHIVE_PATH" >/dev/null 2>&1; then
log "Archive verified ✅"
echo "Archive verified ✅"
ARCHIVE_VERIFIED=true
else
error "Archive verification FAILED — archive may be corrupt"
@@ -260,7 +260,7 @@ if [[ "$CONTAINER_WAS_RUNNING" == true ]]; then
POST_STATUS=$(timeout "$DOCKER_TIMEOUT" docker inspect -f \
'{{.State.Running}}' "$CONTAINER_NAME" 2>/dev/null)
if [[ "$POST_STATUS" == "true" ]]; then
log "$CONTAINER_NAME restarted and running ✅"
echo "$CONTAINER_NAME restarted and running ✅"
RESTART_OK=true
else
error "$CONTAINER_NAME started but crashed immediately — check container logs"
@@ -277,7 +277,7 @@ if [[ "$CONTAINER_WAS_RUNNING" == true ]]; then
RESTART_OK=true
fi
else
log "$CONTAINER_NAME was not running — leaving stopped (state respected) ✅"
echo "$CONTAINER_NAME was not running — leaving stopped (state respected) ✅"
RESTART_OK=true
fi
+2 -2
View File
@@ -110,13 +110,13 @@ if [[ "$ALL_MODE" == true ]]; then
STOPPED_COUNT=$(echo "$STOPPED_IDS" | grep -c . || echo 0)
if [[ "$STOPPED_COUNT" -eq 0 ]]; then
log "No stopped containers"
echo "No stopped containers"
elif [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — would remove $STOPPED_COUNT stopped container(s):"
docker ps -a --filter "status=exited" --filter "status=created" \
--format " {{.Names}} {{.Image}} {{.Status}}" 2>/dev/null
else
log "Removing $STOPPED_COUNT stopped container(s)..."
echo "Removing $STOPPED_COUNT stopped container(s)..."
docker container prune -f 2>&1 | grep -v "^Total\|^$" || true
success "Removed $STOPPED_COUNT stopped container(s)"
fi
+6 -6
View File
@@ -200,7 +200,7 @@ case "$STATUS" in
warn "Stopping $EMBY_CONTAINER — active sessions will be interrupted"
if [[ "$DRY_RUN" == false ]]; then
if timeout "$DOCKER_TIMEOUT" docker stop "$EMBY_CONTAINER" >/dev/null 2>&1; then
log "$EMBY_CONTAINER stopped ✅"
echo "$EMBY_CONTAINER stopped ✅"
sleep 3 # let file handles release
else
error "Failed to stop $EMBY_CONTAINER — aborting"
@@ -263,7 +263,7 @@ for db_rel in "${DB_FILES[@]}"; do
warn "Uncommitted WAL data — will be merged when Emby next starts cleanly"
PASS_DBS+=("$db_name (WAL — see warning)")
else
log "$db_name exists but is empty — no pending transactions ✅"
echo "$db_name exists but is empty — no pending transactions ✅"
PASS_DBS+=("$db_name")
fi
continue
@@ -282,7 +282,7 @@ for db_rel in "${DB_FILES[@]}"; do
error "$db_name — sqlite3 could not open database (locked or corrupt)"
FAIL_DBS+=("$db_name")
elif [[ "$RESULT" == "ok" ]]; then
log "$db_name — integrity check passed ✅"
echo "$db_name — integrity check passed ✅"
PASS_DBS+=("$db_name")
else
error "$db_name — CORRUPTION DETECTED"
@@ -311,7 +311,7 @@ if [[ "$EMBY_WAS_RUNNING" == true ]]; then
POST_STATUS=$(timeout "$DOCKER_TIMEOUT" docker inspect -f \
'{{.State.Running}}' "$EMBY_CONTAINER" 2>/dev/null)
if [[ "$POST_STATUS" == "true" ]]; then
log "$EMBY_CONTAINER restarted and running ✅"
echo "$EMBY_CONTAINER restarted and running ✅"
RESTART_OK=true
else
error "$EMBY_CONTAINER started but crashed — database may be corrupt"
@@ -329,7 +329,7 @@ if [[ "$EMBY_WAS_RUNNING" == true ]]; then
RESTART_OK=true
fi
else
log "$EMBY_CONTAINER was not running — leaving stopped (state respected) ✅"
echo "$EMBY_CONTAINER was not running — leaving stopped (state respected) ✅"
RESTART_OK=true
fi
@@ -351,7 +351,7 @@ echo " $ICON_SUCCESS Passed: ${#PASS_DBS[@]}"
[[ ${#MISSING_DBS[@]} -gt 0 ]] && echo " Skipped: ${#MISSING_DBS[@]} (not found)"
echo ""
[[ ${#PASS_DBS[@]} -gt 0 ]] && for db in "${PASS_DBS[@]}"; do log " $ICON_SUCCESS $db"; done
[[ ${#PASS_DBS[@]} -gt 0 ]] && for db in "${PASS_DBS[@]}"; do echo " $ICON_SUCCESS $db"; done
[[ ${#FAIL_DBS[@]} -gt 0 ]] && for db in "${FAIL_DBS[@]}"; do echo " $ICON_ERROR $db"; done
echo ""
+1 -1
View File
@@ -219,7 +219,7 @@ fi
echo ""
echo "━━━ $ICON_SUMMARY Artists to add (${#MISSING[@]}) ━━━"
for a in "${MISSING[@]}"; do log " $a"; done
for a in "${MISSING[@]}"; do echo " $a"; done
if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN complete — run without --dry-run to add these artists"
+5 -5
View File
@@ -177,7 +177,7 @@ if ! mountpoint -q "$RAMDISK_PATH" 2>/dev/null; then
exit 0
fi
log "Ramdisk is mounted ✅"
echo "Ramdisk is mounted ✅"
# Warn if transcode_manager is running — it may flip symlink back on next cycle
if pgrep -f "transcode_manager.sh" >/dev/null 2>&1; then
@@ -199,10 +199,10 @@ if [[ ! -d "$TRANSCODE_SSD" ]]; then
error "Cannot safely redirect symlink — aborting"
exit 1
}
log "SSD fallback created ✅"
echo "SSD fallback created ✅"
fi
else
log "SSD fallback exists: $TRANSCODE_SSD"
echo "SSD fallback exists: $TRANSCODE_SSD"
fi
START=$(date +%s)
@@ -253,7 +253,7 @@ if [[ "$FILE_COUNT" -gt 0 ]]; then
done
fi
else
log "No active files on ramdisk ✅"
echo "No active files on ramdisk ✅"
fi
# ==============================================================================================
@@ -303,7 +303,7 @@ last_flip_time=$NOW
flip_count_hour=0
flip_hour_start=$NOW
EOF
log "State file updated: current_target=$TRANSCODE_SSD"
echo "State file updated: current_target=$TRANSCODE_SSD"
else
warn "Skipping state file update — stop had errors"
fi
+2 -2
View File
@@ -203,7 +203,7 @@ for pool in "${POOLS_TO_SCRUB[@]}"; do
warn "DRY RUN — would scrub: $pool"
STARTED+=("$pool")
elif zpool scrub "$pool" 2>/dev/null; then
log "$pool scrub started ✅"
echo "$pool scrub started ✅"
STARTED+=("$pool")
else
error "Failed to start scrub on $pool"
@@ -231,7 +231,7 @@ fi
echo ""
echo "━━━ $ICON_TIME Waiting for Scrubs to Complete ━━━"
log "Polling every 60 seconds — scrubs may take hours on large pools"
log "Safe to interrupt — scrubs continue in background if script is stopped"
echo "Safe to interrupt — scrubs continue in background if script is stopped"
while [[ "$SCRUB_RUNNING" == true ]]; do
sleep 60