Skip to content

Commit

Permalink
fix mp3 and png files cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kx1t committed May 22, 2024
1 parent 0b3ea71 commit aea86b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rootfs/etc/s6-overlay/scripts/cleanup
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rootfs/usr/share/noisecapt/noisecapt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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++ ))
Expand Down

0 comments on commit aea86b6

Please sign in to comment.