From 7c5a7032222d0c1c59c464090bad255ac8e0f692 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 29 Apr 2026 18:33:03 +0000 Subject: [PATCH] Fix sky-cam-audio-capture.service spurious failure on no-op retention MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The retention block ended with `[ test ] && echo`, which under `set -e` returns exit 1 when `deleted` is 0 — the normal case on most days. As the script's last command, that bash exit propagated to systemd, which marked the unit failed and fired the OnFailure ntfy even though the audio file was written successfully. Add `|| true` and an explicit `exit 0` so a no-op retention pass is treated as success. --- sunrise-audio-capture.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sunrise-audio-capture.sh b/sunrise-audio-capture.sh index 3fdc129..610d605 100755 --- a/sunrise-audio-capture.sh +++ b/sunrise-audio-capture.sh @@ -90,5 +90,7 @@ retain="${SUNRISE_AUDIO_RETENTION_DAYS:-7}" if [ "$retain" -gt 0 ]; then audio_root="${AUDIO_DIR:-$BASE_DIR/audio}/sunrise/$CAM" deleted=$(find "$audio_root" -name "sunrise-audio.m4a" -mtime +"$retain" -print -delete 2>/dev/null | wc -l) - [ "$deleted" -gt 0 ] && echo "Retention: deleted $deleted sunrise audio clip(s) older than ${retain}d" + [ "$deleted" -gt 0 ] && echo "Retention: deleted $deleted sunrise audio clip(s) older than ${retain}d" || true fi + +exit 0