From 9039803a51b5d3136f93a2a87d68aa38f0220fa8 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 20 Apr 2026 00:29:47 +0000 Subject: [PATCH] Fix undefined CAM_NAME crash; log when window already closed on re-run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 4-seasons.sh, fullday-video.sh: CAM_NAME fallback referenced undefined \$CAM_NAME — under set -euo pipefail this crashes if called manually without an argument. Changed to fall back to \$SUNRISE_CAM (matches capture.sh). daily_sunrise_video.sh: add log message when the capture window has already closed (manual re-run after the fact). Behaviour is unchanged — processing proceeds immediately — but the operator now gets a clear confirmation rather than silence. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- 4-seasons.sh | 2 +- daily_sunrise_video.sh | 2 ++ fullday-video.sh | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/4-seasons.sh b/4-seasons.sh index 03c825e..9ed36f6 100755 --- a/4-seasons.sh +++ b/4-seasons.sh @@ -14,7 +14,7 @@ source "$SCRIPT_DIR/sky-cam.conf" export TIMEZONE # make it visible to season_info.py subprocess # Camera name: first argument overrides conf (systemd passes it via ExecStart). -CAM_NAME="${1:-$CAM_NAME}" +CAM_NAME="${1:-$SUNRISE_CAM}" # ── Configuration ────────────────────────────────────────────────────────────── base_dir="$BASE_DIR" diff --git a/daily_sunrise_video.sh b/daily_sunrise_video.sh index 72a2399..a338ebf 100644 --- a/daily_sunrise_video.sh +++ b/daily_sunrise_video.sh @@ -57,6 +57,8 @@ if [ "$now_day_sec" -lt "$end_sec" ]; then wait_sec=$(( end_sec - now_day_sec + 30 )) echo "Waiting ${wait_sec}s for capture window to finish (ends $(date -d "@$(( midnight + end_sec ))" '+%H:%M:%S'))..." sleep "$wait_sec" +else + echo "Capture window already closed at $(date -d "@$(( midnight + end_sec ))" '+%H:%M:%S') — processing available images" fi # ── Collect images in window ────────────────────────────────────────────────── diff --git a/fullday-video.sh b/fullday-video.sh index c2df80a..29e536d 100755 --- a/fullday-video.sh +++ b/fullday-video.sh @@ -11,7 +11,7 @@ SCRIPT_DIR="$(dirname "$(realpath "$0")")" source "$SCRIPT_DIR/sky-cam.conf" # Camera name: first argument overrides conf (systemd passes it via ExecStart). -CAM_NAME="${1:-$CAM_NAME}" +CAM_NAME="${1:-$SUNRISE_CAM}" # ── Configuration ────────────────────────────────────────────────────────────── base_dir="$BASE_DIR"