Elastix Wiki

This is for cleaning up old call recordings after X period of time, so your old PC with low storage availability doesn't get full of them.

Add this as a cron job

Auto-delete after 90 days (change the 90, to your specific needs)

/usr/bin/find /var/spool/asterisk/monitor/*.wav -mtime 90 -delete

for a percentage based solution:

while (( `df /|/usr/bin/tail -1|/usr/bin/awk '{print $5'}|/bin/sed 's/\%//'` >= 76 ));do  /bin/rm -f `/bin/ls -tr /var/spool/asterisk/monitor/*.wav| /usr/bin/head -n 1` ;done

Extracted from Forums