cron job to erase old FreePBX backups
Hi, my freepbx backups get bigger and bigger and bigger by the week. Is there a cron job to delete all the backups once a month and just keep the most recent one? Or at least just erase the entire backup folder once a month?
I would appreciate if someone can take the time to set up such a cron job for me
Thanks a lot
0 0 * * 0 root find /var/lib/asterisk/backups/daily/ -mtime +30 -exec rm -f {} \; > /dev/null
Deletes everything older than 30 days. You may need to change the directory as you may have named your backups something else, so verify it on the file system first.
I knew I was forgetting to put something in my training material and this was it...
Ethan,
Your use of find is a great easy fix :-) to maintain the directory size. What I am looking for is a cron to trim the size of the backups which are growing exponentially every week. Since the box does not trim / archive the CDR records in the MYsql database.
In PostgreSQL I could do a select into a table for month n, then delete and then vacuum. Reusing the month n table every year would ensure no more than 12 months of activity and a fairly consistent size backup after the first 12 months of installation.
What is the best way to do that here ? Not very current on the MySQL interface.
TIA...
phonebuff,
See my post of maintaining CDR sizes:
http://trixbox.org/forums/trixbox-forums/help/mysql-cdr-table-siz...



Member Since:
2006-11-26