Exclude files in Weekly and Monthly backups only
I would like to retain two daily, two weekly, and two monthly backups but don't have the disk space to do so. There is not any indication that I can find in the documentation that would allow me to exclude certain folders from weekly and monthly backups only and two other posters asked about this very topic 6 and 8 years ago.
So I was thinking, can I create two template files and use cron jobs to copy them to cpbackup-exclude.conf right before and after the weekly and monthly backups?
For example, exclude some old folders that don't really change much at all, if ever:
cpbackup-full
==========
public_html/wp-content/updraft
public_html/wp-content/backups-dup-lite
cpbackup-slim
==========
public_html/wp-content/updraft
public_html/wp-content/backups-dup-lite
public_html/wp-content/uploads/2019
public_html/wp-content/uploads/2020
public_html/wp-content/uploads/2021
Then in crontab:
0 0 * * 0 cp /home/myacct/cpbackup-slim /home/myacct/cpbackup-exclude.conf
0 0 * * 1 cp /home/myacct/cpbackup-full /home/myacct/cpbackup-exclude.conf
0 0 1 * * cp /home/myacct/cpbackup-slim /home/myacct/cpbackup-exclude.conf
0 0 2 * * cp /home/myacct/cpbackup-full /home/myacct/cpbackup-exclude.conf
I also imagine that there would be a few times a year that I would have NO backups of the three WP upload years 2019-2021 in either daily backup when the first day of the month is a Monday, ie. folders excluded on Sunday AND Monday, if my logic is correct. This only happened three times in 2024 (January, April, July) and won't happen again until September 2025.
Does this make sense?
-
Hey there! That sounds like a perfectly fine plan to me - add your customizations just before the weekly and monthly backups run, and then remove them before the dailies run. I don't see any issues with this.
1 -
This strategy worked perfectly. Ok, not perfectly. Perfectly would be if the backups would allow weekly and monthly to have their own cpbackup-exclude.conf or directives in that file. It did work as I expected though and that is good for now.
I was a little thrown when the size of the /backups/monthly folder went down to 24 bytes, but found out it was because it was a hardlink to the daily backup, and when that daily backup was rotated out, it was moved into the monthly location and the size of /backups/monthly returned to 27 Gb, which was way less than the 54 Gb of a full backup.
If you use this method be aware of the periods of time I mentioned above because your daily backups will not be full backups when the weekly and monthly are run, and when the weekly and monthly are one day apart that is two days in a row your daily backups will not be full backups.
0 -
You're always welcome to submit a feature request at features.cpanel.net for that expanded functionality, and I'll make sure the right team sees it!
0
Please sign in to leave a comment.
Comments
3 comments