Back Up a HostGator Account to rsync.net

 

HostGator, a large shared hosting, vps, and dedicated server provider, makes available SSH (shell) access to their customers. Even the simplest, least expensive shared web hosting account gives the owner the ability to log in over SSH, into a shell, and run commands.

You must manually enable SSH access on your HostGator account, and this document on their site explains how. We found that ssh access was enabled within a few minutes of toggling that setting in the "view hosting packages" section of our billing control panel.

 

The HostGator Shell Environment

 

The HostGator shell environment is restricted in some ways, but not in any ways that affect a standard backup procedure with rsync, over SSH. As you can see:

[rsyncnet@gator123 ~]$
[rsyncnet@gator123 ~]$ pwd
/home/rsyncnet
[rsyncnet@gator123 ~]$
[rsyncnet@gator123 ~]$ which rsync
/usr/bin/rsync
[rsyncnet@gator123 ~]$
[rsyncnet@gator123 ~]$ which ssh
/usr/bin/ssh
[rsyncnet@gator123 ~]$
[rsyncnet@gator123 ~]$ crontab -l
MAILTO="info@rsync.net"
0 0 * * * /usr/bin/rsync -av /home/rsyncnet 1234@usw-s001.rsync.net:
[rsyncnet@gator123 ~]$

rsync, ssh (and ssh-keygen) are available as well as the crontab facility.

 

Setting Up SSH Keys

 

As with any unix system, the first step in setting up automated backups is to create SSH keys and share the public key with your rsync.net account.

We are happy to say that no modifications are necessary to our standard HOWTO. Simply follow this document exactly and you will have working SSH keys in your HostGator account.

 

Choosing What to Back Up

 

In the shared web hosting account that we use to do our testing, we see that our home directory has the following path:

[rsyncnet@gator123 ~]$ pwd
/home/rsyncnet
[rsyncnet@gator123 ~]$

So, a simple configuration would be to back up our entire HostGator account, with a command like this:

/usr/bin/rsync -av /home/rsyncnet 1234@usw-s001.rsync.net:

Note that we specified the full path to our home directory on the HostGator server. Alternatively, we could back up just our web site(s) (our HTML files) with a command like this:

/usr/bin/rsync -av /home/rsyncnet/public_html 1234@usw-s001.rsync.net:

Again, note the use of the full path to that directory in our rsync command.

We are very happy to write your rsync command(s) for you - simply email rsync.net support and ask.

 

 

Scheduling With cron

 

cron works exactly as you would expect it to on the HostGator systems. This test job, for instance, worked perfectly for us:

[rsyncnet@gator123 ~]$ crontab -l
MAILTO="info@rsync.net"
0 * * * * /usr/bin/rsync -av /home/rsyncnet 1234@usw-s001.rsync.net:
[rsyncnet@gator123 ~]$

 

Support

 

If you have any problems with this process, do not hesitate to email support@rsync.net - we will help you immediately, and have you up and running that same day.

 

Click here for Simple Pricing - Or call 619-819-9156 or email info@rsync.net for more information.