Need an easier way to backup my various sites

Discussion in 'Site & Server Administration' started by crazyFoo, Jun 30, 2009.

  1. #1
    I build custom sites (PHP & MySQL), and I have terrible backup habits. I really need an automated way to backup all of the site files, and all of the database information to multiple locations.

    As of right now, I haven't found a way to do this that I have been happy with. I'm completely open to purchasing software to accomplish this if I have to.

    How does everyone handle full site backups?

    Features I would like:
    -I want dated backups of both the files and the database. It would be nice to have them all wrapped up in to some sort of archive (.zip, .7z. .rar, whatever)
    -I want it to backup to my work computer, and an offsite backup location.
    -I want it to be automated, and I want to be able to select the frequency for various different sites.
     
    crazyFoo, Jun 30, 2009 IP
  2. vasyl

    vasyl Peon

    Messages:
    138
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    cron+script (unix) - under windows can be done the same - code like following:

    
    #!/bin/sh
    files=/var/tmp/files
    database=databasename
    dbuser=username
    dbpasswd=dbpwd
    remoteuser=remoteusername
    remotepasswd=remotepassword
    remoteplace=/backups
    hostid=host13
    
    cd /var/tmp
    mkdir backup
    cp -R $files ./backup
    mysqldump -u $dbuser $database -p$dbpasswd > ./backup/db.sql
    arcname=$hostid`date +%s`.tar
    tar -cf $hostid`date +%s`.tar backup
    rm -Rf backup
    bzip2 $hostid`date +%s`.tar
    scp $hostid`date +%s`.tar.bz2 $remoteuser:$remotepassword@$remotehost:$remoteplace
    rm -f $hostid`date +%s`.tar.bz2
    
    
    
    Code (markup):
     
    vasyl, Jun 30, 2009 IP
  3. crazyFoo

    crazyFoo Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I usually end up using hosting plans that have CPanel on them. Most of the time I find CPanel's backup features most unhelpful.

    Vasyl, could you explain your code a bit? I'm not that familiar with Unix commands. Do I run this on the server, or on my local machine? It looks like this is something that I run on the server. If that is the case, I don't think it will be a possibility for me because I usually use shared hosting plans. Please correct me if I'm wrong.
     
    crazyFoo, Jun 30, 2009 IP
  4. vasyl

    vasyl Peon

    Messages:
    138
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Shared hosting plan usually means a kind of control panel that have some backup functions.

    The solution draft provided is for dedicated/VPS...
     
    vasyl, Jun 30, 2009 IP
  5. crazyFoo

    crazyFoo Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thanks vasyl. I really do need to get a dedicated server or a VPS sometime, I'm just not there yet.

    How do most people make daily backups in a shared environment? I know how to use the backup utility in the admin area, but there has got to be a better way. I'm guessing some software that makes an FTP call to the site and pulls down all of the files or something.
     
    crazyFoo, Jun 30, 2009 IP
  6. maestria

    maestria Well-Known Member

    Messages:
    705
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    110
    #6
    If you are provided with a cpanel by the host, you have the facility you wanted, like creating a backup and then downloading the same to your local machine.
    but i dont think there is any automated or timely mechanism where the backup would be send every hour to your mail or some other similar fascility over there.
     
    maestria, Jul 1, 2009 IP