FREE PBX – script to automatically delete recordings

This script allows to automatically delete voice call recordings every night at 1:15am.

This will delete all recordings older then 60 days.

You need to created a cron job on freePBX server.

  1. SSH into your server and at the prompt, type (this will create a new cronjob on your server and enter “vi editor”):
    ——————-
    crontab -e
    ——————-
  2. Press esc
  3. Press i (for “insert”) to begin editing file
  4. Paste/type the following text into corn job
    ——————-
    15 1 * * * find /var/spool/asterisk/monitor/ -name “*.wav” -mtime +60 -delete >/dev/null 2>&1
    ——————-
  5. Press esc again to exit editing mode
  6. Type :wq to save (w – write) and to exit (q – quite) the file.
  7. Verify your cronjob:
    ——————-
    crontab -l
    ——————-

You are all set, your server will now delete older recordings every night.

If you need to change time when this happens check out this page to see how to modify cron job