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
+14 -14
View File
@@ -222,8 +222,8 @@ fi
CONTAINER_HEALTH=$(timeout "$DOCKER_TIMEOUT" docker inspect -f \
'{{.State.Health.Status}}' "$SONARR_CONTAINER" 2>/dev/null)
case "$CONTAINER_HEALTH" in
healthy) log "$SONARR_CONTAINER is healthy" ;;
"") log "$SONARR_CONTAINER has no health check — proceeding" ;;
healthy) info "$SONARR_CONTAINER is healthy" ;;
"") info "$SONARR_CONTAINER has no health check — proceeding" ;;
starting)
error "$SONARR_CONTAINER is still starting — aborting"
notify "Sonarr cleanup aborted on $(hostname) — container still starting" \
@@ -237,7 +237,7 @@ case "$CONTAINER_HEALTH" in
*) warn "$SONARR_CONTAINER health: $CONTAINER_HEALTH — proceeding with caution" ;;
esac
log "Safety layer 1 passed — container healthy"
info "Safety layer 1 passed — container healthy"
# ==============================================================================================
# ── HELPER FUNCTIONS ──────────────────────────────────────────────────────────────────────────
@@ -312,10 +312,10 @@ done
unset _cp
if [[ -n "$SONARR_CONTAINER_ROOT" ]]; then
log "Triggering DownloadedEpisodesScan on: $SONARR_CONTAINER_ROOT"
info "Triggering DownloadedEpisodesScan on: $SONARR_CONTAINER_ROOT"
SCAN_PAYLOAD="{\"name\": \"DownloadedEpisodesScan\", \"path\": \"$SONARR_CONTAINER_ROOT\"}"
else
log "No path map match — triggering DownloadedEpisodesScan (all root folders)"
info "No path map match — triggering DownloadedEpisodesScan (all root folders)"
SCAN_PAYLOAD='{"name": "DownloadedEpisodesScan"}'
fi
@@ -330,7 +330,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=${SONARR_IMPORT_SCAN_TIMEOUT:-600}
POLLED=0
while [[ "$POLLED" -lt "$POLL_TIMEOUT" ]]; do
@@ -339,7 +339,7 @@ else
"${SONARR_URL}/api/v3/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
@@ -365,7 +365,7 @@ fi
# Safety Layer 3 — API version check
check_arr_version "$SONARR_URL" "$SONARR_API_KEY" "v3" "$SONARR_VERSION_MAJOR" "Sonarr" || exit 1
log " Querying Sonarr API..."
info "Querying Sonarr API..."
# Fetch all series
SERIES_RESPONSE=$(sonarr_api "series") || {
@@ -386,7 +386,7 @@ if [[ "$SERIES_COUNT" -eq 0 ]]; then
exit 1
fi
log "Found $SERIES_COUNT series — fetching episode files..."
info "Found $SERIES_COUNT series — fetching episode files..."
TMP_DIR="/tmp/sonarr_cleanup_$$"
mkdir -p "$TMP_DIR"
@@ -418,7 +418,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
@@ -429,14 +429,14 @@ if [[ "$TRACKED_COUNT" -eq 0 ]]; then
exit 1
fi
log " $SERIES_COUNT series | $TRACKED_COUNT tracked episode files"
info "$SERIES_COUNT series | $TRACKED_COUNT tracked episode files"
# ==============================================================================================
# ━━━ Scan TV Root ━━━
# ==============================================================================================
echo ""
echo "━━━ $ICON_CLEAN Scanning TV Root ━━━"
log " Root: $SONARR_TV_ROOT | Orphan age: ${SONARR_ORPHAN_AGE} days"
info "Root: $SONARR_TV_ROOT | Orphan age: ${SONARR_ORPHAN_AGE} days"
START=$(date +%s)
ORPHAN_COUNT=0
@@ -536,12 +536,12 @@ if [[ "$DRY_RUN" == false ]]; then
done | sort -u
)
log "Cleaning up empty folders..."
info "Cleaning up empty folders..."
for host_path in "${ARR_PATH_MAP[@]}" "$SONARR_TV_ROOT"; do
[[ -d "$host_path" ]] && \
find "$host_path" -mindepth 1 -type d -empty -delete 2>/dev/null
done
log "Empty folders removed"
info "Empty folders removed"
fi
END=$(date +%s)