How to Backup Dreamhost Files and Email Them Using Cron
Backing up your website is one of the most important things you can do. No matter how much traffic or content your site has, if you loose it your website will decline rapidly. This tutorial will show you how to create a script to backup your files and email them to you regularly.
Backup your Dreamhost Files
Create Your Backup Location
- Login to your FTP for your Dreamhost site. Then Create a folder called backup inside
- In this folder create a folder with the name of your website
Create the Backup Script
- Create a file called backup.sh and put the following code inside the file
suffix=$(date +%d_%m_%y)
tar -zcf /home/%username%/backup/benosullivan/ben.backup.$suffix.tar.gz /home/%username%/benosullivan.co.uk/
uuencode /home/%username%/backup/benosullivan/ben.backup.$suffix.tar.gz backup.$suffix.tar.gz | mailx -s "Email Title Goes Here" "Your email address goes here"
- Change %username% to your FTP username
- Change backup/benosullivan/ to the folder you created previously
- Change /home/%username%/benosullivan.co.uk/ on the second line to the folder you want to backup
- Finally change the email settings at the very end to meet your needs
- Copy this file to your backup folder
Create your Cron Job
- Login to your Dreamhost control panel. Select Cron Jobs under Goodies
- Create a new Cron Job
- In the command field enter the following command (Replace %username% with the same username as before)
/home/%username%/backup/backup.sh
- Give it a name and select how often you want it to run
- Well done! Your website will now automatically backup and email it to you


Sample Config for WordPress Running on Varnish 2.1
Are you using 32 bit or 64 bit Office 2010?
Have Outlook 2010 Automatically Close a Message After Replying or Forwarding
How to Start Outlook 2010 in a Different Folder
Do you get Error Code 80071392 Using Windows Live Messenger?
How To Image, Sysprep and Deploy Windows 7 a Complete Guide – Using sysprep and Imagex
How to Disable Auto Renewal for Xbox Live
Installing Windows 7 From a USB Stick From Windows XP (Bootable USB) 