fix(log/echo): log → info for section-level status across 4 scripts

lidarr_cleanup, sonarr_cleanup, radarr_cleanup:
  container health result, safety layer 1 pass, import scan queued/complete,
  API query, found N items, in-memory map built, item|tracked count,
  tracked% safety check, first-run baseline, root/orphan-age config,
  empty folder cleanup start/done

cert_monitor:
  domains to check count, warn/crit threshold display

Per-item loop lines (Fetching N/M, Still scanning..., OK per-domain)
remain as log() — verbose only.
This commit is contained in:
Gmer4Lfe
2026-05-23 09:58:19 -04:00
parent b76072a318
commit 4c559f7791
4 changed files with 48 additions and 48 deletions
+17 -17
View File
@@ -172,7 +172,7 @@ detect_hosts
# Skip if Lidarr is not configured on this host
if [[ -z "${LIDARR_URL:-}" ]] || [[ -z "${LIDARR_API_KEY:-}" ]]; then
log "Lidarr not configured on $MY_ID ($LOCAL_SERVER_NAME) — skipping"
info "Lidarr not configured on $MY_ID ($LOCAL_SERVER_NAME) — skipping"
exit 0
fi
@@ -243,8 +243,8 @@ fi
CONTAINER_HEALTH=$(timeout "$DOCKER_TIMEOUT" docker inspect -f \
'{{.State.Health.Status}}' "$LIDARR_CONTAINER" 2>/dev/null)
case "$CONTAINER_HEALTH" in
healthy) log "$LIDARR_CONTAINER is healthy" ;;
"") log "$LIDARR_CONTAINER has no health check — proceeding" ;;
healthy) info "$LIDARR_CONTAINER is healthy" ;;
"") info "$LIDARR_CONTAINER has no health check — proceeding" ;;
starting)
error "$LIDARR_CONTAINER is still starting — aborting"
notify "Lidarr cleanup aborted on $(hostname) — container still starting" \
@@ -258,7 +258,7 @@ case "$CONTAINER_HEALTH" in
*) warn "$LIDARR_CONTAINER health: $CONTAINER_HEALTH — proceeding with caution" ;;
esac
log "Safety layer 1 passed — container healthy"
info "Safety layer 1 passed — container healthy"
# ==============================================================================================
# ── HELPER FUNCTIONS ──────────────────────────────────────────────────────────────────────────
@@ -326,10 +326,10 @@ done
unset _cp
if [[ -n "$LIDARR_CONTAINER_ROOT" ]]; then
log "Triggering DownloadedAlbumsScan on: $LIDARR_CONTAINER_ROOT"
info "Triggering DownloadedAlbumsScan on: $LIDARR_CONTAINER_ROOT"
SCAN_PAYLOAD="{\"name\": \"DownloadedAlbumsScan\", \"path\": \"$LIDARR_CONTAINER_ROOT\"}"
else
log "No path map match — triggering DownloadedAlbumsScan (all root folders)"
info "No path map match — triggering DownloadedAlbumsScan (all root folders)"
SCAN_PAYLOAD='{"name": "DownloadedAlbumsScan"}'
fi
@@ -344,7 +344,7 @@ SCAN_CMD_ID=$(echo "$SCAN_RESPONSE" | jq -r '.id // empty' 2>/dev/null)
if [[ -z "$SCAN_CMD_ID" ]]; then
warn "Could not trigger import scan — proceeding without pre-flight"
else
log " Import scan queued (command ID: $SCAN_CMD_ID) — waiting for completion..."
info "Import scan queued (command ID: $SCAN_CMD_ID) — waiting for completion..."
POLL_TIMEOUT=${LIDARR_IMPORT_SCAN_TIMEOUT:-600}
POLLED=0
while [[ "$POLLED" -lt "$POLL_TIMEOUT" ]]; do
@@ -353,7 +353,7 @@ else
"${LIDARR_URL}/api/v1/command/${SCAN_CMD_ID}" 2>/dev/null | \
jq -r '.status // empty' 2>/dev/null)
case "$SCAN_STATUS" in
completed) log "Import scan complete ✅"; break ;;
completed) info "Import scan complete ✅"; break ;;
failed) warn "Import scan reported failed — proceeding anyway"; break ;;
esac
sleep 10
@@ -379,7 +379,7 @@ fi
# Safety Layer 3 — API version check
check_arr_version "$LIDARR_URL" "$LIDARR_API_KEY" "v1" "$LIDARR_VERSION_MAJOR" "Lidarr" || exit 1
log " Querying Lidarr API..."
info "Querying Lidarr API..."
# Fetch all artists
ARTIST_RESPONSE=$(lidarr_api "artist") || {
@@ -400,7 +400,7 @@ if [[ "$ARTIST_COUNT" -eq 0 ]]; then
exit 1
fi
log "Found $ARTIST_COUNT artists — fetching track files..."
info "Found $ARTIST_COUNT artists — fetching track files..."
TMP_DIR="/tmp/lidarr_cleanup_$$"
mkdir -p "$TMP_DIR"
@@ -429,7 +429,7 @@ while IFS= read -r _tracked_path; do
[[ -n "$_tracked_path" ]] && TRACKED_MAP["$_tracked_path"]=1
done < "$TRACKED_FILE"
unset _tracked_path
log "Built in-memory lookup map: ${#TRACKED_MAP[@]} tracked paths"
info "Built in-memory lookup map: ${#TRACKED_MAP[@]} tracked paths"
TRACKED_COUNT=$(wc -l < "$TRACKED_FILE")
# Safety Layer 5 — tracked count > 0
@@ -440,7 +440,7 @@ if [[ "$TRACKED_COUNT" -eq 0 ]]; then
exit 1
fi
log " $ARTIST_COUNT artists | $TRACKED_COUNT tracked files"
info "$ARTIST_COUNT artists | $TRACKED_COUNT tracked files"
# Safety Layer 6 — percentage drop vs last known count
if [[ -f "$LIDARR_TRACKED_COUNT_FILE" ]]; then
@@ -455,10 +455,10 @@ if [[ -f "$LIDARR_TRACKED_COUNT_FILE" ]]; then
"Lidarr Cleanup" "warning"
exit 1
fi
log "Tracked count: ${PCT}% of last run ($TRACKED_COUNT vs $LAST_COUNT) ✅"
info "Tracked count: ${PCT}% of last run ($TRACKED_COUNT vs $LAST_COUNT) ✅"
fi
else
log "No previous count on record — first run, saving baseline"
info "No previous count on record — first run, saving baseline"
fi
echo "$TRACKED_COUNT" > "$LIDARR_TRACKED_COUNT_FILE"
@@ -468,7 +468,7 @@ echo "$TRACKED_COUNT" > "$LIDARR_TRACKED_COUNT_FILE"
# ==============================================================================================
echo ""
echo "━━━ $ICON_CLEAN Scanning Music Root ━━━"
log " Root: $LIDARR_MUSIC_ROOT | Orphan age: ${LIDARR_ORPHAN_AGE} days"
info "Root: $LIDARR_MUSIC_ROOT | Orphan age: ${LIDARR_ORPHAN_AGE} days"
START=$(date +%s)
ORPHAN_COUNT=0
@@ -563,9 +563,9 @@ if [[ "$DRY_RUN" == false ]]; then
done < <(find "$LIDARR_MUSIC_ROOT" -type f 2>/dev/null)
log "Cleaning up empty folders..."
info "Cleaning up empty folders..."
find "$LIDARR_MUSIC_ROOT" -mindepth 1 -type d -empty -delete 2>/dev/null
log "Empty folders removed"
info "Empty folders removed"
fi
END=$(date +%s)