Open alex-eri opened 2 months ago
It's probably easier to delete unneeded files with cron or a periodic task. You can match on filename prefix like /recordings//2023 or timestamp.
Already
#!/bin/bash
RECPATH="/mnts/rec_temp"
FREESPACE=$(df --output=avail -B 1 ${RECPATH} | tail -n 1)
if [ ${FREESPACE} -lt 1073741824 ]
then
find "${RECPATH}" -type f -printf "%T@ %p\n" | sort -n | head -n 1 | tee /dev/stderr | cut -d' ' -f2 | xargs echo rm
else
echo free space ${FREESPACE}
fi
but if mediamtx manages max age i think it can also manage space.
#!/bin/bash
RECPATH="/mnts/rec_temp"
FREESPACE=$(df --output=avail -B 1 ${RECPATH} | tail -n 1)
if [ ${FREESPACE} -lt 1073741824 ]
then
find "${RECPATH}" -type f -printf "%T@ %p\n" | sort -n | head -n 1 | tee /dev/stderr | cut -d' ' -f2 | xargs echo rm
else
echo free space ${FREESPACE}
fi
Describe the feature
I mount dedicated hard disk to
/recordings/
path. Since codec is h264 variable bitrate i can write from 24 to 48 hours in this storage.I want to server remove old files when no free space for new segment.