DreamHostAll DreamHost hosting plans have full backup "snapshots" of your data (all the files and directories) taken at regular intervals (two hourly backups, two daily backups, and two weekly backups). This means that it is possible for you restore your site from a backup that DreamHost took in the last hour (that’s the latest). The procedure to restore your site from one of these backups is outlined in the reference link mentioned at the end of this post. You can also write a small shell script which will backup all the current latest contents of a directory of your web space as a .tar.gz file. Once this .sh file is ready, you can use cron to run it automatically at any time interval of your choice.

The following are the steps one should take to set up the daily automatic backups of this blog’s theme directory. The backed up file will be stored on the server as well as sent as an email attachment.



  1. Connect to your web space using a SSH client. Enter these commands one after another
  2. mkdir backups
    
    mkdir backups/archives
    
  3. Save the following as howtotuts_theme_files_backup.sh (replace srikat with your DreamHost username, admin@howtotuts.com with your email address, howtotuts.com with your domain name)
  4. #!/bin/bash
    
    suffix=$(date +%y%m%d)
    tar -zvcf /home/srikat/backups/archives/howtotuts_themebackup.$suffix.tar.gz /home/srikat/howtotuts.com/wp-content/themes/freicurv
    echo "My theme files" | mutt -s "My theme files" -a /home/srikat/backups/archives/howtotuts_themebackup.$suffix.tar.gz admin@howtotuts.com
    
  5. Upload howtotuts_theme_files_backup.sh to backups directory and CHMOD it 755.
  6. From the shell, navigate into backups directory (cd backups/) and type
  7. dos2unix howtotuts_theme_files_backup.sh
    
    ./howtotuts_theme_files_backup.sh
    
  8. You should see the processing of all the files scroll by and once it’s complete, check archives directory to find the created backup having an extension of tar.gz. You can also see that the back up is in your mail inbox.
  9. Now visit https://panel.dreamhost.com/index.cgi?tree=goodies.cron and add a new cron job and set it to run daily. The command to run is:
  10. /home/username/backups/howtotuts_theme_files_backup.sh
    

If you would like to backup the contents of an entire domain, repeat this with a new .sh file and make sure to specify the domain name with a trailing slash in the last-but-one line of step 2. Ex.: howtotuts.com/

Reference: http://wiki.dreamhost.com/Backup

We hope you found this how-to helpful. Please social bookmark this tutorial and help us and others. Thanks in advance.
Tags: ,

This post has 2 comments.

  1. bro hand
    26 May 08
    8:50 pm

    Why not just use the cpanel function?

  2. admin
    26 May 08
    9:00 pm

    DreamHost uses its own custom panel.

Close
E-mail It