Tools echo/log audit pass — 9 scripts + Manual

No setup banners to remove (Tools folder was already clean). Fix log→echo
on summary status/conclusion lines across container_data_export, emby_database_repair,
recreate_shares, zfs_pool_scrub, and fallback_state_reset (safety check + two summary
detail lines). Fix log→echo on status display lines in watchdog_skip_list_manager
(skip list empty, restart history lines). Move per-item "to add" preview echoes to
log in emby_to_lidarr/radarr/sonarr_sync; fix nothing-to-do log→echo in all three.
Add output tiers section to Manual-Tools.md.
This commit is contained in:
Gmer4Lfe
2026-05-21 16:58:32 -04:00
parent 789d376eb3
commit 5ccfb895c1
10 changed files with 35 additions and 18 deletions
+17
View File
@@ -24,6 +24,23 @@ making any changes.
---
## Output Tiers
All tools have two output levels controlled by `--log`.
Without `--log`, each script processes and always concludes with a summary block
showing identity, duration, counts, and a status line. Warnings and errors are
always visible. State-display scripts (watchdog_skip_list_manager, zfs_pool_scrub
`--status`, fallback_state_reset current-state section) always show their state
output — `--log` adds configuration detail and per-item resolution within each
section.
With `--log`, per-item detail appears: individual items added/skipped, per-database
check results, per-pool scan lines, per-container stop/start state, per-directory
creation results. Use when debugging unexpected results or confirming a first run.
---
## emby_to_lidarr_sync.sh
One-shot bootstrap tool. Scans Emby play history, finds artists you've actually
+1 -1
View File
@@ -304,7 +304,7 @@ echo ""
if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — no changes made"
elif [[ "$ARCHIVE_VERIFIED" == true && "$RESTART_OK" == true ]]; then
log "$ICON_DONE Status: done — $ARCHIVE_NAME"
echo "$ICON_DONE Status: done — $ARCHIVE_NAME"
elif [[ "$ARCHIVE_VERIFIED" == false ]]; then
echo "$ICON_ERROR Status: archive verification FAILED — check backup before relying on it"
else
+2 -2
View File
@@ -352,7 +352,7 @@ echo "$ICON_TIME Duration: $(format_duration $(( END - START )))"
echo ""
echo " $ICON_SUCCESS Passed: ${#PASS_DBS[@]}"
[[ ${#FAIL_DBS[@]} -gt 0 ]] && echo " $ICON_ERROR Failed: ${#FAIL_DBS[@]}"
[[ ${#MISSING_DBS[@]} -gt 0 ]] && log "Skipped: ${#MISSING_DBS[@]} (not found)"
[[ ${#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
@@ -378,7 +378,7 @@ elif [[ ${#FAIL_DBS[@]} -gt 0 ]]; then
notify "Emby database CORRUPTION on $(hostname) — failed: ${FAIL_DBS[*]} — manual intervention needed" \
"Emby DB Repair" "warning"
else
log "$ICON_DONE Status: all ${#PASS_DBS[@]} databases healthy ✅"
echo "$ICON_DONE Status: all ${#PASS_DBS[@]} databases healthy ✅"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+2 -2
View File
@@ -224,13 +224,13 @@ IFS=$'\n' MISSING=($(printf '%s\n' "${MISSING[@]}" | sort))
echo " Already tracked: $ALREADY | Missing from Lidarr: ${#MISSING[@]}"
if [[ "${#MISSING[@]}" -eq 0 ]]; then
log "Lidarr already tracks everything played on Emby"
echo "Lidarr already tracks everything played on Emby"
exit 0
fi
echo ""
echo "━━━ $ICON_SUMMARY Artists to add (${#MISSING[@]}) ━━━"
for a in "${MISSING[@]}"; do echo " $a"; done
for a in "${MISSING[@]}"; do log " $a"; done
if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN complete — run without --dry-run to add these artists"
+2 -2
View File
@@ -229,7 +229,7 @@ IFS=$'\n' SORTED_MISSING=($(printf '%s\n' "${!MISSING[@]}" | sort))
echo " Already tracked: $ALREADY | Missing from Radarr: ${#MISSING[@]}"
if [[ "${#MISSING[@]}" -eq 0 ]]; then
log "Radarr already tracks everything in Emby"
echo "Radarr already tracks everything in Emby"
exit 0
fi
@@ -237,7 +237,7 @@ echo ""
echo "━━━ $ICON_SUMMARY Movies to add (${#MISSING[@]}) ━━━"
for name in "${SORTED_MISSING[@]}"; do
_tmdb="${MISSING[$name]}"
echo " $name${_tmdb:+ (TMDB: $_tmdb)}"
log " $name${_tmdb:+ (TMDB: $_tmdb)}"
done
if [[ "$DRY_RUN" == true ]]; then
+2 -2
View File
@@ -239,7 +239,7 @@ IFS=$'\n' SORTED_MISSING=($(printf '%s\n' "${!MISSING[@]}" | sort))
echo " Already tracked: $ALREADY | Missing from Sonarr: ${#MISSING[@]}"
if [[ "${#MISSING[@]}" -eq 0 ]]; then
log "Sonarr already tracks everything in Emby"
echo "Sonarr already tracks everything in Emby"
exit 0
fi
@@ -247,7 +247,7 @@ echo ""
echo "━━━ $ICON_SUMMARY Series to add (${#MISSING[@]}) ━━━"
for name in "${SORTED_MISSING[@]}"; do
_tvdb="${MISSING[$name]}"
echo " $name${_tvdb:+ (TVDB: $_tvdb)}"
log " $name${_tvdb:+ (TVDB: $_tvdb)}"
done
if [[ "$DRY_RUN" == true ]]; then
+3 -3
View File
@@ -151,7 +151,7 @@ if pgrep -f "fallback.sh" >/dev/null 2>&1; then
echo ""
warn "If you are sure you want to proceed anyway, confirm below"
else
log "fallback.sh is not running — safe to reset ✅"
echo "fallback.sh is not running — safe to reset ✅"
fi
# Check current state — if already NORMAL warn user
@@ -238,8 +238,8 @@ if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — no changes made"
else
warn "$ICON_DONE State reset to NORMAL"
log "fallback.sh will resume from NORMAL on next cycle"
log "No containers were started or stopped"
echo "fallback.sh will resume from NORMAL on next cycle"
echo "No containers were started or stopped"
echo ""
[[ "$FALLBACK_RUNNING" == true ]] && \
warn "⚠️ fallback.sh was running during reset — monitor next cycle carefully"
+1 -1
View File
@@ -293,6 +293,6 @@ elif [[ ${#FAILED[@]} -gt 0 ]]; then
"Recreate Shares" "warning"
exit 1
else
log "$ICON_DONE Status: done — ${#CREATED[@]} created, ${#SKIPPED[@]} skipped"
echo "$ICON_DONE Status: done — ${#CREATED[@]} created, ${#SKIPPED[@]} skipped"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+3 -3
View File
@@ -152,7 +152,7 @@ fi
echo ""
if [[ "$SKIP_COUNT" -eq 0 ]]; then
log "Skip list: empty — all containers monitored normally ✅"
echo "Skip list: empty — all containers monitored normally ✅"
else
warn "$SKIP_COUNT container(s) on skip list — manual intervention needed:"
echo ""
@@ -177,9 +177,9 @@ fi
echo ""
echo "━━━ $ICON_WATCHDOG Restart History ━━━"
if [[ "$RESTART_COUNT" -eq 0 ]]; then
log "No restart history"
echo "No restart history"
else
log "$RESTART_COUNT restart entries (window: ${WATCHDOG_CONTAINER_RESTART_WINDOW}h)"
echo "$RESTART_COUNT restart entries (window: ${WATCHDOG_CONTAINER_RESTART_WINDOW}h)"
echo ""
awk -F'|' '{counts[$1]++} END {
for (c in counts)
+2 -2
View File
@@ -281,7 +281,7 @@ for pool in "${STARTED[@]}"; do
error " $ERRORS"
POOLS_ERRORS+=("$pool")
else
log "$pool$SCAN_LINE"
echo "$pool$SCAN_LINE"
POOLS_OK+=("$pool")
fi
done
@@ -304,7 +304,7 @@ if [[ ${#POOLS_ERRORS[@]} -gt 0 ]]; then
notify "ZFS scrub errors on $(hostname) ($MY_ID) — pools with errors: ${POOLS_ERRORS[*]}" \
"ZFS Scrub" "warning"
elif [[ ${#POOLS_OK[@]} -gt 0 ]]; then
log "$ICON_DONE Status: all ${#POOLS_OK[@]} pools clean ✅"
echo "$ICON_DONE Status: all ${#POOLS_OK[@]} pools clean ✅"
fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"