diff --git a/rootfs/etc/s6-overlay/scripts/cleanup b/rootfs/etc/s6-overlay/scripts/cleanup index ed89165..e3c0a26 100755 --- a/rootfs/etc/s6-overlay/scripts/cleanup +++ b/rootfs/etc/s6-overlay/scripts/cleanup @@ -33,7 +33,7 @@ CLEANUP () if (( OLDERTHAN > 0 )) then find /tmp -mindepth 1 -mtime +2 -delete 2>/dev/null - find /run/noisecapt/*.log -mtime +"$OLDERTHAN" -delete 2>/dev/null + find /run/noisecapt/ -name '*.log' -mtime +"$OLDERTHAN" -delete 2>/dev/null tail -n $MAXLOGLINES /run/noisecapt/noisecapt.log >/run/noisecapt/noisecapt.log.tmp 2>/dev/null mv -f /run/noisecapt/noisecapt.log.tmp /run/noisecapt/noisecapt.log 2>/dev/null else diff --git a/rootfs/usr/share/noisecapt/noisecapt.sh b/rootfs/usr/share/noisecapt/noisecapt.sh index 60c2501..e458a00 100755 --- a/rootfs/usr/share/noisecapt/noisecapt.sh +++ b/rootfs/usr/share/noisecapt/noisecapt.sh @@ -206,8 +206,8 @@ while true; do # LOG "ln -sf ${OUTFILE}pectro-$(date -d @"$AUDIOTIME" +%y%m%d-%H%M%S).png ${OUTFILE}/spectro-latest.png" # clean up any PNG spectrograms older than 12 hours (720 minutes): DTIME="$(( ${PF_DELETEAFTER:-1} * 60 ))" - find "$OUTFILE"spectro-*.png -maxdepth 1 -mmin +"$DTIME" -delete - find "$OUTFILE"recording-*.mp3 -maxdepth 1 -mmin +"$DTIME" -delete + find "${OUTFILE%/*}" -name 'noisecapt-spectro-*.png' -mmin +"$DTIME" -delete + find "${OUTFILE%/*}" -name 'noisecapt-recording-*.mp3' -mmin +"$DTIME" -delete # clean up log file if necessary: (( LOOPCOUNTER++ ))