I have a CentOS server running with backup made to an external HDD.
I run a full backup everyday at 4am and incremental backups every 2 hour. I am keeping the last 30 days backups which is achieved by running a cron job every day at 6am which clears all files older than 30 days:
0 6 * * * root /bin/find /mnt/hp/backups -mtime +30 -exec rm -f {} \;
Recently my HDD is getting out of space so I am changing my backup strategy to only keep 4 full backups for last 4 weeks. Eg, full backup of the every Monday.
How do I write a script to keep last 4 full backup for the past 4 weeks? I am using dump to perform the backups