Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have a VPS with WiredTree.com in which I have access to WHM.

I'm looking for a good backup solution where I can do the following things

  • Backups both the Database and Files
  • Allow me access to the backups so that I can restore them on another server to ensure that backups are actually successful.

Any good options out there I should look at?

Thanks for any tips.

share|improve this question

1 Answer 1

Backups should always be on another server.

You can use rsync for your files, and mysqldump your for mysql databases.

I run a backup via cron, just using tar, mysqldump and SSHFS. This is a very simple solution, but works for me. Here my code (all in the root crontab).

MAILTO=crontab@website.com

#Mysql daily
30 4 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 * * /usr/bin/mysqldump --user=root --password=passwd --opt --all-databases | gzip -2 > /root/backups/even/all.gz
30 4 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 * * /usr/bin/mysqldump --user=root --password=passwd --opt --all-databases | gzip -2 > /root/backups/odd/all.gz

#Files Daily
0 2 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 * * tar cf /root/backups/even/etc.tar /etc/ /var/spool/cron/ /usr/local/sim
0 2 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 * * tar cf /root/backups/odd/etc.tar /etc/ /var/spool/cron/ /usr/local/sim
15 2 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30 * * tar cf /root/backups/even/home.tar /home/
15 2 1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31 * * tar cf /root/backups/odd/home.tar /home/

# Weekly
0 6 7,21 * * rm -f /root/backups/week/* && cp /root/backups/odd/* /root/backups/week/
0 6 14,28 * * rm -f /root/backups/week/* && cp /root/backups/even/* /root/backups/week/

0 1 * * * unmount /root/backups
1 0 * * * /usr/bin/sshfs -o idmap=user -p 22 backups@server.com:/home/backups /root/backups > /dev/null
share|improve this answer
    
This is exactly what I use but for local backups. SSHFS and mail functions i'll be adding. rsync and mysqldump are great simple scripts for backing up files and databases. –  Anagio Nov 19 '12 at 6:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.