Incremental Backup

Discussion in 'Installation/Configuration' started by chrno, May 15, 2006.

  1. chrno

    chrno New Member

    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.


    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/*
    
     
  2. falko

    falko Super Moderator

  3. chrno

    chrno New Member

    Cool thanks! Looks like I've got everything covered :D
     

Share This Page