View Single Post
  #1  
Old 15th May 2006, 19:57
chrno chrno is offline
Member
 
Join Date: Apr 2006
Posts: 70
Thanks: 0
Thanked 1 Time in 1 Post
Default Incremental Backup

Hi,

I've setup the following script to run in crontab on my Debian box. The idea is to backup all of ISPConfig's setting and upload it to another FTP server. It is based around a 7 day incremental backup strategy, where 1 full backup is made each week and daily incremental backup's are made in-between. This will enables data to be restored from any day within that week.

Quote:
Question:-
Are there any flaws in this strategy? i.e. if I had to rebuild another server from scratch, I should be able to just restore the data isn't it?

Weekly Full Backup
Code:
#!/bin/sh
cd /mnt/backups
rm /mnt/backups/*
tar pczvf - --listed-incremental /mnt/backups/etc-log.snar /etc | split -b 20m - /mnt/backups/etc-full-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/www-log.snar /var/www | split -b 20m - /mnt/backups/www-full-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/bind-log.snar /var/lib/named/etc/bind | split -b 20m - /mnt/backups/bind-full-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/ispconfig-log.snar /root/ispconfig | split -b 20m - /mnt/backups/ispconfig-full-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/admispconfig-log.snar /home/admispconfig | split -b 20m - /mnt/backups/admispconfig-full-`date '+%d-%B-%Y'`.tar.gz.
mysqldump --opt -u %USERNAME% --password="%PASSWORD%" --all-databases --add-drop-database --add-drop-table | bzip2 -c > /mnt/backups/%SERVERNAME%-`date '+%d-%B-%Y'`.sql.bz2
ftp-upload -h %FTP-ADDRESS% -u %USERNAME% --password %PASSWORD% -b -d /private/backup/ /mnt/backups/*

Daily Incremental Backup
Code:
#!/bin/sh
cd /mnt/backups
tar pczvf - --listed-incremental /mnt/backups/etc-log.snar /etc | split -b 20m - /mnt/backups/etc-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/www-log.snar /var/www | split -b 20m - /mnt/backups/www-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/bind-log.snar /var/lib/named/etc/bind | split -b 20m - /mnt/backups/bind-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/ispconfig-log.snar /root/ispconfig | split -b 20m - /mnt/backups/ispconfig-`date '+%d-%B-%Y'`.tar.gz.
tar pczvf - --listed-incremental /mnt/backups/admispconfig-log.snar /home/admispconfig | split -b 20m - /mnt/backups/admispconfig-`date '+%d-%B-%Y'`.tar.gz.
mysqldump --opt -u %USERNAME% --password="%PASSWORD%" --all-databases --add-drop-database --add-drop-table | bzip2 -c > /mnt/backups/%SERVERNAME%-`date '+%d-%B-%Y'`.sql.bz2
ftp-upload -h %FTP-ADDRESS% -u %USERNAME% --password %PASSWORD% -b -d /private/backup/ /mnt/backups/*
Reply With Quote
Sponsored Links