WHM has a great backup feature which lets you offload all your backups to Amazon S3.
Its simple to setup and frees up your server space.
Although setting up is easy, restoring from S3 is not quite as easy.
The backups do not show up for users to restore themselves and nor do they show in WHM’s backup recovery.
Instead, you have to manually copy the backup from Amazon S3 back to the server in order to restore.
I came across a post in the cPanel forums, a user by the name of DanH42 posted a script on how to do this easily with the aid of s3cmd and a batch script.
Step One, Install & Configure s3cmd
sudo wget -O /etc/yum.repos.d/s3tools.repo http://s3tools.org/repo/RHEL_6/s3tools.repo sudo yum install s3cmd s3cmd --configure
Make sure you choose to verify the settings.
Step Two, Modify Batch Script
#! /bin/bash backup_dir="/backup" # The directory cPanel puts backups in, without trailing slash s3_bucket_name="mybucket" # Set this to the name of your S3 bucket s3_prefix="/backups" # Leave blank ("") if you don't use a prefix if [ -z "$1" ] || [ -z "$2" ]; then echo "Usage: remote-restore YYYY-MM-DD <user>" exit fi cd "$backup_dir/$1/accounts" && sudo s3cmd get "s3://$s3_bucket_name$s3_prefix/$1/$2.tar.gz" read -p "Press the [Enter] key once you are done restoring the backup..." sudo rm *.tar.gz
Once the changes are made, give the script execute rights with chmod +x remote-restore
Step Three, Restore your backup
remote-restore 2015-12-31 joe
It will then download the backup to the correct location and you can go into WHM and restore the backup from that day.
Once the restore is complete you can press enter on the script and it will remove the backup from the server, freeing up the space again.
Press the [Enter] key once you are done restoring the backup…
I did find that my restore was stuck in a pending state, so I ran the following command.
The restore fired off straight away.