Alpine-based sdr-cleanup container runs a find loop every 5 minutes, deleting MP3 files under 3 KB (configurable via SIZE_THRESHOLD env var) to keep the web browser and Samba share free of false-positive recordings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
528 B
Bash
Executable File
17 lines
528 B
Bash
Executable File
#!/bin/sh
|
|
# Deletes small MP3 recordings that are likely noise/false positives.
|
|
# Runs in a loop, intended for use inside a Docker container.
|
|
#
|
|
# Environment variables:
|
|
# SIZE_THRESHOLD - find -size format, e.g. 3k, 5k, 10k (default: 3k)
|
|
# INTERVAL - seconds between runs (default: 300)
|
|
|
|
RECORDINGS_DIR="/recordings"
|
|
SIZE_THRESHOLD="${SIZE_THRESHOLD:-3k}"
|
|
INTERVAL="${INTERVAL:-300}"
|
|
|
|
while true; do
|
|
find "$RECORDINGS_DIR" -type f -name '*.mp3' -size "-${SIZE_THRESHOLD}" -mmin +1 -delete
|
|
sleep "$INTERVAL"
|
|
done
|