As a host, I've always wanted to store multiple copies of my users backups. I also feel that the current daily / weekly : monthly system is outdated as all my users have databases which change so often that, restoring a monthly backup, would be setting them back to the stone age 
There are a few scripts floating around which keep multiple versions of backups / copy the daily to the "day of the week". I was not 100% satisfied with those solutions, so I came up with my own solution. Some pointers on where my script differs from the others. Read below carefully!
- This script runs BEFORE cpbackup, so place it in /scripts/precpbackup
- No backups are copied, they are renamed. This saves on disk space and IO.
- You have to configure cPanel to ONLY tae a DAILY backup. The script will handle the weekly. As no weeklies are created, again saving on IO.
- You can define the number of daily / weekly copies to keep. Monthlies are not created as i don't need that.
- Because daily and weekly folders still exist, they can sttill be downloaded by the end-user from within cPanel.
How the script works:
- The script runs BEFORE the backups are taken.
- Your current "daily" is renamed to "daily_YYYYMMDD_HHMM" or "weekly_YYYYMMDD_HHMM". The date is the date that the folder was created (so generally yesteday date).
- weeklies / dailies are deleted if their number exceeds the value set (DAYS_TO_KEEP / WEEKS_TO_KEEP)
And finally, the script:
Code:
#####################################
# How2 Solutions - http://how2.be
# Keep Daily Backup
# version 2.2
#####################################
# Configuration
DAYS_TO_KEEP=3
WEEKS_TO_KEEP=2
#####################################
CPBACKUP_DEST_PATH="/backup/cpbackup"
# check if the cpbackup directory exists
if [ ! -d "$CPBACKUP_DEST_PATH" ]
then
echo "FATAL ERROR - CPBACKUP_DEST_PATH not found"
exit 1
fi
# process weekly
if [ -d "$CPBACKUP_DEST_PATH/weekly" ]
then
# check if weekly older then 6.5 days
if [ $(( (`date +%s` - `stat -L --format %Y "$CPBACKUP_DEST_PATH/weekly/"`) > (60*60*156) )) -eq 1 ];
then
# weekly is archived
WEEKLY_DATE=$(stat "$CPBACKUP_DEST_PATH/weekly" --format %y|cut -f1 -d'.')
WEEKLY_DATE=${WEEKLY_DATE//[-:]/}
WEEKLY_TARGET=$CPBACKUP_DEST_PATH/weekly_${WEEKLY_DATE/ /_}
mv "$CPBACKUP_DEST_PATH/weekly" "$WEEKLY_TARGET"
else
echo "weekly not older then 6.5 days";
fi
else
# no weekly, nothing to rename
echo "$CPBACKUP_DEST_PATH/weekly not found"
fi
# process daily
if [ -d "$CPBACKUP_DEST_PATH/daily" ]
then
if [ ! -d "$CPBACKUP_DEST_PATH/weekly" ]
then
# daily becmes new weekly
mv "$CPBACKUP_DEST_PATH/daily" "$CPBACKUP_DEST_PATH/weekly"
else
# daily is archived
DAILY_DATE=$(stat "$CPBACKUP_DEST_PATH/daily" --format %y|cut -f1 -d'.')
DAILY_DATE=${DAILY_DATE//[-:]/}
DAILY_TARGET=$CPBACKUP_DEST_PATH/daily_${DAILY_DATE/ /_}
mv "$CPBACKUP_DEST_PATH/daily" "$DAILY_TARGET"
fi
else
# no daily, nothing to rename
echo "$CPBACKUP_DEST_PATH/daily not found"
fi
# find and delete old folders
rm -Rf `ls $CPBACKUP_DEST_PATH/daily_* -td | tail -n +$DAYS_TO_KEEP`
rm -Rf `ls $CPBACKUP_DEST_PATH/weekly_* -td | tail -n +$WEEKS_TO_KEEP`
exit 1
Feel free to use / change / comment. If you like it, please leave a message 
The only part I'm not yet 100% happy with is that sometimes your weekly is more newer then your daily. Not confusing to me but might be for the end-user downloading from within cPanel. I will probably change this someday into a system I like better.