GalerieBlogUnity3D ExamplesKontaktSitemapFullsitemap

changed my backup strategy today

Today I had to rethink my backup strategy on my server!

Until today I used rdiff-backup to backup my home folder.
On every "restore" I had to reread it's manual :-(

Alain mentioned rsnap (original written by Daniel).

I want to keep backups:
  • daily backup's for a week
  • weekly backup's for a month
  • and keep a backup for every month.
So I have written a small wrapper around rsnap:
#!/bin/sh
# get day of month (e.g, 01)
DOM=`date +%d`
# get day of week (0..6); 0 is Sunday
DOW=`date +%w`
# numbers of backup to keep
NOB=
# backup method folder
BMF=
# source folder to backup
SRC="/home/"
# destination folder/location for backup
DST="SOMEUSER@SOMEHOST:/SOMEPATH/home/"
# path to rsnap
RSNAP=/usr/local/bin/rsnap

# choose which backup method:
if [ '01' == $DOM ]; then
    echo "first of month -> montly backup!"
    NOB=12
    BMF="MONTHLY/"
elif [ '0' == $DOW ]; then
    echo "it's sunday -> weekly backup!"
    NOB=5
    BMF="WEEKLY/"
else
    echo "do a daily backup!"
    NOB=6
    BMF="DAILY/"
fi
$RSNAP $NOB $SRC $DST$BMF
Hope this is usefull for someone.
(just replace: SOMEUSER, SOMEHOST, SOMEPATH, SRC and DST)
 Permalink

Kommentare

Keine (weiteren) neuen Kommentare erlaubt.