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 ## emby_to_lidarr_sync.sh
One-shot bootstrap tool. Scans Emby play history, finds artists you've actually 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 if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — no changes made" warn "DRY RUN — no changes made"
elif [[ "$ARCHIVE_VERIFIED" == true && "$RESTART_OK" == true ]]; then 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 elif [[ "$ARCHIVE_VERIFIED" == false ]]; then
echo "$ICON_ERROR Status: archive verification FAILED — check backup before relying on it" echo "$ICON_ERROR Status: archive verification FAILED — check backup before relying on it"
else else
+2 -2
View File
@@ -352,7 +352,7 @@ echo "$ICON_TIME Duration: $(format_duration $(( END - START )))"
echo "" echo ""
echo " $ICON_SUCCESS Passed: ${#PASS_DBS[@]}" echo " $ICON_SUCCESS Passed: ${#PASS_DBS[@]}"
[[ ${#FAIL_DBS[@]} -gt 0 ]] && echo " $ICON_ERROR Failed: ${#FAIL_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 "" 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 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" \ notify "Emby database CORRUPTION on $(hostname) — failed: ${FAIL_DBS[*]} — manual intervention needed" \
"Emby DB Repair" "warning" "Emby DB Repair" "warning"
else else
log "$ICON_DONE Status: all ${#PASS_DBS[@]} databases healthy ✅" echo "$ICON_DONE Status: all ${#PASS_DBS[@]} databases healthy ✅"
fi fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" 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[@]}" echo " Already tracked: $ALREADY | Missing from Lidarr: ${#MISSING[@]}"
if [[ "${#MISSING[@]}" -eq 0 ]]; then if [[ "${#MISSING[@]}" -eq 0 ]]; then
log "Lidarr already tracks everything played on Emby" echo "Lidarr already tracks everything played on Emby"
exit 0 exit 0
fi fi
echo "" echo ""
echo "━━━ $ICON_SUMMARY Artists to add (${#MISSING[@]}) ━━━" 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 if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN complete — run without --dry-run to add these artists" 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[@]}" echo " Already tracked: $ALREADY | Missing from Radarr: ${#MISSING[@]}"
if [[ "${#MISSING[@]}" -eq 0 ]]; then if [[ "${#MISSING[@]}" -eq 0 ]]; then
log "Radarr already tracks everything in Emby" echo "Radarr already tracks everything in Emby"
exit 0 exit 0
fi fi
@@ -237,7 +237,7 @@ echo ""
echo "━━━ $ICON_SUMMARY Movies to add (${#MISSING[@]}) ━━━" echo "━━━ $ICON_SUMMARY Movies to add (${#MISSING[@]}) ━━━"
for name in "${SORTED_MISSING[@]}"; do for name in "${SORTED_MISSING[@]}"; do
_tmdb="${MISSING[$name]}" _tmdb="${MISSING[$name]}"
echo " $name${_tmdb:+ (TMDB: $_tmdb)}" log " $name${_tmdb:+ (TMDB: $_tmdb)}"
done done
if [[ "$DRY_RUN" == true ]]; then 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[@]}" echo " Already tracked: $ALREADY | Missing from Sonarr: ${#MISSING[@]}"
if [[ "${#MISSING[@]}" -eq 0 ]]; then if [[ "${#MISSING[@]}" -eq 0 ]]; then
log "Sonarr already tracks everything in Emby" echo "Sonarr already tracks everything in Emby"
exit 0 exit 0
fi fi
@@ -247,7 +247,7 @@ echo ""
echo "━━━ $ICON_SUMMARY Series to add (${#MISSING[@]}) ━━━" echo "━━━ $ICON_SUMMARY Series to add (${#MISSING[@]}) ━━━"
for name in "${SORTED_MISSING[@]}"; do for name in "${SORTED_MISSING[@]}"; do
_tvdb="${MISSING[$name]}" _tvdb="${MISSING[$name]}"
echo " $name${_tvdb:+ (TVDB: $_tvdb)}" log " $name${_tvdb:+ (TVDB: $_tvdb)}"
done done
if [[ "$DRY_RUN" == true ]]; then if [[ "$DRY_RUN" == true ]]; then
+3 -3
View File
@@ -151,7 +151,7 @@ if pgrep -f "fallback.sh" >/dev/null 2>&1; then
echo "" echo ""
warn "If you are sure you want to proceed anyway, confirm below" warn "If you are sure you want to proceed anyway, confirm below"
else else
log "fallback.sh is not running — safe to reset ✅" echo "fallback.sh is not running — safe to reset ✅"
fi fi
# Check current state — if already NORMAL warn user # Check current state — if already NORMAL warn user
@@ -238,8 +238,8 @@ if [[ "$DRY_RUN" == true ]]; then
warn "DRY RUN — no changes made" warn "DRY RUN — no changes made"
else else
warn "$ICON_DONE State reset to NORMAL" warn "$ICON_DONE State reset to NORMAL"
log "fallback.sh will resume from NORMAL on next cycle" echo "fallback.sh will resume from NORMAL on next cycle"
log "No containers were started or stopped" echo "No containers were started or stopped"
echo "" echo ""
[[ "$FALLBACK_RUNNING" == true ]] && \ [[ "$FALLBACK_RUNNING" == true ]] && \
warn "⚠️ fallback.sh was running during reset — monitor next cycle carefully" 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" "Recreate Shares" "warning"
exit 1 exit 1
else else
log "$ICON_DONE Status: done — ${#CREATED[@]} created, ${#SKIPPED[@]} skipped" echo "$ICON_DONE Status: done — ${#CREATED[@]} created, ${#SKIPPED[@]} skipped"
fi fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
+3 -3
View File
@@ -152,7 +152,7 @@ fi
echo "" echo ""
if [[ "$SKIP_COUNT" -eq 0 ]]; then if [[ "$SKIP_COUNT" -eq 0 ]]; then
log "Skip list: empty — all containers monitored normally ✅" echo "Skip list: empty — all containers monitored normally ✅"
else else
warn "$SKIP_COUNT container(s) on skip list — manual intervention needed:" warn "$SKIP_COUNT container(s) on skip list — manual intervention needed:"
echo "" echo ""
@@ -177,9 +177,9 @@ fi
echo "" echo ""
echo "━━━ $ICON_WATCHDOG Restart History ━━━" echo "━━━ $ICON_WATCHDOG Restart History ━━━"
if [[ "$RESTART_COUNT" -eq 0 ]]; then if [[ "$RESTART_COUNT" -eq 0 ]]; then
log "No restart history" echo "No restart history"
else else
log "$RESTART_COUNT restart entries (window: ${WATCHDOG_CONTAINER_RESTART_WINDOW}h)" echo "$RESTART_COUNT restart entries (window: ${WATCHDOG_CONTAINER_RESTART_WINDOW}h)"
echo "" echo ""
awk -F'|' '{counts[$1]++} END { awk -F'|' '{counts[$1]++} END {
for (c in counts) for (c in counts)
+2 -2
View File
@@ -281,7 +281,7 @@ for pool in "${STARTED[@]}"; do
error " $ERRORS" error " $ERRORS"
POOLS_ERRORS+=("$pool") POOLS_ERRORS+=("$pool")
else else
log "$pool$SCAN_LINE" echo "$pool$SCAN_LINE"
POOLS_OK+=("$pool") POOLS_OK+=("$pool")
fi fi
done done
@@ -304,7 +304,7 @@ if [[ ${#POOLS_ERRORS[@]} -gt 0 ]]; then
notify "ZFS scrub errors on $(hostname) ($MY_ID) — pools with errors: ${POOLS_ERRORS[*]}" \ notify "ZFS scrub errors on $(hostname) ($MY_ID) — pools with errors: ${POOLS_ERRORS[*]}" \
"ZFS Scrub" "warning" "ZFS Scrub" "warning"
elif [[ ${#POOLS_OK[@]} -gt 0 ]]; then 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 fi
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"