Fix undefined CAM_NAME crash; log when window already closed on re-run
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
This commit is contained in:
+1
-1
@@ -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"
|
||||
|
||||
@@ -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 ──────────────────────────────────────────────────
|
||||
|
||||
+1
-1
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user