I have a lot of backups, like:
backup-20130528_054504_mysql.tar.gz,
bill_db_201305290130.BAK.bz2,
etc_20130412.tbz
This is full backups which done each day.
Before today, I have a cron task with a command line like this:
/usr/bin/find /media/backups -ctime +7 -delete
But it was the bad idea.
One server stopped do new backups (filesystem was full) more than 7 days ago, and all old backups was deleted by cron.
Probably I need a new script as replacement for this "find -ctime", which will hold some old backups anyway.
All my backup files have names {unique_prefix}YYYYMMDD...
I want something like :
- one backup for each year before last year
- one backup for each month of last year
- 4 backup for each week of previous month
- and 7 backups for last 7 days.
for each {unique_prefix}.
All this files are downloaded to my server by cron via rsync, ssh , etc..
I dislike reinvent the wheel, and pretty sure that is a typical task.
Please, point me to the solution.