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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user