Backup Scripts for Cloud Sites

Please Donate:

If you like this script and use it, please consider donating below to off-set my costs - after all, you know it's hard to find this sort of thing!


First a disclaimer: I am a web designer, I make things look pretty. I don't know how to write command line code. I don't know how this all functions, but it does, and has been doing so on my sites for about 6 months now. You're completely on your own to use this and implement it.

What I was looking for:
Like many of you, I have clients on Rack Space's cloud sites and was looking for a way to allow backups on a regular, automated schedule.

What this is:
I worked with a very talented developer to come up with two scripts that can be uploaded to the cloud sites' directory and run nightly with a cron job. They copy the files associated with the web site as well as any defined databases. All the content is compressed, and stored locally each time the script is ran (in my case nightly). Then at the end of the cycle of runs (each 7 days in my case), the script FTPs the compressed archives off-site a FTP server I have.

What this is NOT:
A fully secure/vetted solution. I'm NOT a security expert, nor am I transferring/backing up data that is sensitive.This fits my needs and in searching I haven't seen anything like it, so thought I would share.

How to implement:
Download a .zip of the files here.

There are two shell script files,, and I created a "backup" folder in my Cloud Site's domain root (right alongside "logs", "lib" and "web"). Into that "backup" folder I put both these files after configuring them. Then you go into the Cloud control panel for your site and set up a cron job that runs that points to "backup/"

That's it.... Wait for the cron to run and see the results in both the local backup folder and also any FTP server you define. Below is my attempt at a plain English explanation of the config file options with line numbers.

Line Number: Entry: Explanation:
8 ACCOUNT_ROOT="/mnt/stor3-wc2-dfw1/12345/12345/" The full path to your site as defined under "Features"on your cloud sites control panel.
10 WEB_SITE="" The name of your domain with the "www"
12 FTPNUM=7 The number of iterations/local backups before the script sends a copy off-site to your off-site FTP server. In my case I have my script running every night which creates 7 local copies, then on the 7th night, it cycles and causes the FTP transfer.
20 DB_NAME[0]="12345_something" The name of the first database you'd like to backup.
21 DB_HOST_0="" The cloud host of where your database is.
22 DB_USER_0="12345_something" The username of the first database you'd like to backup.
23 DB_PASS_0="aHardPazzword" The password of the first database you'd like to backup.
25-28 SAME FOR 2nd (and more) databases SAME FOR 2nd (and more) databases
34 OMIT_DIR[0]="video" This is a simple way to omit one or more directories that you don't want backed up. In my example, I had a video folder that was full of large files that I also had locally, so I didn't want to include in the backup archive.
40 FTP_HOST='' The url of your offsite FTP server where you want the backedup
41 FTP_USER='offsiteusername' your remote FTP username
42 FTP_PASS='offsitepassword' your remote FTP password
43 FTP_DIR='/backup' the directory path of where you want the backups to go
47 SITE_ROOT="$ACCOUNT_ROOT/web/content" You can edit this if you NEED to, but should be good for Cloud Sites as of 10/13/11
48 BACK_ROOT="$ACCOUNT_ROOT/backup" This needs to jive with whereever you upload the script files to.. as I said "backup/" in my example.

So that's pretty much it. I would download/try/use. If you like it, buy me a beer through PayPal below - I spent a lot of time and money working with my developer to get this to do everything I needed to do, but still be flexible enough to use from one site to the next on my Cloud Sites environment. If you have any suggestions on how to improve the script or how to edit this how-to, please e-mail me at: - Thanks, Jay.


If you like this script and use it, please consider donating below to off-set my costs - after all you know it's hard to find this sort of thing!

$5.00 $10.00 $15.00 $25.00 $50.00 $100.00