From 8a7739502c14f0fcbd34d8eaf13f4d0bf897c1b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 23 Apr 2026 12:00:57 +0000 Subject: [PATCH] fix: daily_sunrise_video.sh exits non-zero, blocking OnSuccess= upload Conditional expressions like `[ "$count" -gt 0 ] && echo ...` return 1 when count is 0 (nothing to delete). Under set -euo pipefail with no explicit exit 0, that false becomes the script's exit code. systemd sees failure, OnSuccess= for sunrise2mm.py never fires, and the Mattermost upload is silently skipped every day. Fix: add || true to all end-of-script conditional-echo statements and to the cam_audio cleanup line, then add an explicit exit 0 so the success path always exits cleanly. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ --- daily_sunrise_video.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/daily_sunrise_video.sh b/daily_sunrise_video.sh index c3076fa..bb0908a 100755 --- a/daily_sunrise_video.sh +++ b/daily_sunrise_video.sh @@ -356,10 +356,10 @@ if $step3b_ok; then -name "*-daily-sunrise-test.mp4" \ -mtime +"$demo_retain" -print -delete 2>/dev/null | wc -l) [ "$deleted_demo" -gt 0 ] && \ - echo "Demo retention: deleted $deleted_demo test file(s) older than ${demo_retain} days" + echo "Demo retention: deleted $deleted_demo test file(s) older than ${demo_retain} days" || true fi else - [ -f "${cam_audio:-}" ] && rm -f "${cam_audio:-}" + [ -f "${cam_audio:-}" ] && rm -f "${cam_audio:-}" || true "$SCRIPT_DIR/notify.sh" "Sunrise ready: $current_date" \ "$(basename "$final_video") — ${actual_dur}s, sunrise at ${SR_TIME} | $final_video" || true @@ -370,7 +370,9 @@ if $step3b_ok; then -path "*/sunrise-only/*-daily-sunrise.mp4" \ -mtime +"$retain" -print -delete 2>/dev/null | wc -l) [ "$deleted_old" -gt 0 ] && \ - echo "Retention: deleted $deleted_old sunrise video(s) older than ${retain} days" + echo "Retention: deleted $deleted_old sunrise video(s) older than ${retain} days" || true fi fi fi + +exit 0