ftocc

cron job to erase old FreePBX backups

ja133
Posts: 2110
Member Since:
2006-11-26

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



ethans
Posts: 421
Member Since:
2007-01-16
0 0 * * 0 root find

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 Schroeder - ethan d.o.t schroeder a.t schmoozecom d.o.t com
Comprehensive bounty list | Blog



simsjrg
Posts: 79
Member Since:
2008-04-04
Niiiiice!

I was just thinking about this myself. Thanks Ethan!

Joseph, I see you replaced your email addy with an image... spammage much? ;-)

--

Running: trixbox CE 2.6.1 | Teliax and Vitelity



ja133
Posts: 2110
Member Since:
2006-11-26
Ethan, thanks so

Ethan, thanks so much
simsjrg, yes, WAY too much spam and it is getting out of hand already. Even my personal email account was getting spam!!



simsjrg
Posts: 79
Member Since:
2008-04-04
Yea those spyder and web

Yea those spyder and web crawlers scrape addresses non-stop. It's almost retarded...

--

Running: trixbox CE 2.6.1 | Teliax and Vitelity



ja133
Posts: 2110
Member Since:
2006-11-26
How do I edit the cron file?

How do I edit the cron file? I had instructions on that but I cant find it anymore
Thanks



gbrook
Posts: 211
Member Since:
2006-06-06
Use your friend - WebMin

Use your friend - WebMin under cron scheduled jobs

Cheers
Garry



lazytt
Posts: 175
Member Since:
2006-06-21
edit /etc/crontab, then

edit /etc/crontab, then service crond restart

--

Moshe Brevda, FreePBX Development Team
FreePBX tips and tricks



phonebuff
Posts: 430
Member Since:
2007-02-15
Find is the easy fix ...

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...



ja133
Posts: 2110
Member Since:
2006-11-26
I ran the cron job with

I ran the cron job with webmin and got this back:

Output from command find /var/lib/asterisk/backups/Weekly/ -mtime +30 -exec ..

find: missing argument to `-exec'



ja133
Posts: 2110
Member Since:
2006-11-26
Got it working with this

Got it working with this article



ethans
Posts: 421
Member Since:
2007-01-16
phonebuff, See my post of

phonebuff,

See my post of maintaining CDR sizes:
http://trixbox.org/forums/trixbox-forums/help/mysql-cdr-table-siz...

--

Ethan Schroeder - ethan d.o.t schroeder a.t schmoozecom d.o.t com
Comprehensive bounty list | Blog



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.