cPanel: Simple Script To Backup Over rSync

August 20th, 2007 by Richy B. Leave a reply »

If you are running a reasonably recent version of cPanel (I think v11 or later), you have the ability to run WHM backups over rsync instead of just FTP. This post, if it isn’t obvious, is intended for people with root access to their cPanel server.

So how do you do this?

Simple, configure the backups as per normal in WHM to backup your secondary hard drive or a set partition on your main hard drive. Then just add a script via the shell command line as “/scripts/postcpbackup” (open PuTTY, connect to the server, login, “su” to root if necessary if you didn’t login as root, type “nano -w /scripts/postcpbackup”) and past the following script:

#!/bin/sh
rsync -vrplogDth /backup/cpbackup/* username@backupserver:/backuplocation/

Replacing “/backup/cpbackup/” with the location of your “local backups” if you changed it from the default, “username” with the username of your rSync account, “backupserver” with the hostname/IP address of the backup server and “backuplocation” of the place to store the backups. (It’s CTRL+X to exit nano by the way).

You then just need to make it executable by running “chmod a+x /scripts/postcpbackup” and you are done!

Hope it helps someone!

This post is over 6 months old.

This means that, despite my best intentions, it may no longer be accurate.

This blog holds over 12 years of archived content - during that time, I may have changed my opinion of something, technology will have advanced (and old "best standards" may no longer be the case), my technology "know how" has improved etc etc - it would probably take me a considerable amount of time to update all the archival entries: and defeat the point of keeping them anyway.

Please take these posts for what they are: a brief look into my past, my history, my journey and "caveat emptor".

Leave a Reply

gamy-dance
%d bloggers like this: