Fix sky-cam-audio-capture.service spurious failure on no-op retention

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.
This commit is contained in:
Claude
2026-04-29 18:33:03 +00:00
parent cba5b5b1e8
commit 7c5a703222
+3 -1
View File
@@ -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