create rsync incremental backups with hardlinking

Quite short and simple bash script:

#!/bin/bash
# Simple weekly bash backup script all variables explain themselves
# Version 1.03

what=”/ka”
where=”/ba”
set -e

today=$(date +’%Y-%m-%d’)
last=$(ls -r $where | head -1)
delete=$(ls -r $where | tail -n +7)

cd $where
nice -n 19 rsync –bwlimit=10000 –info=progress2 –link-dest=$where/$last $what $where/$today

[ -z “$delete” ] || rm -rf $delete

Leave a Reply

Your email address will not be published. Required fields are marked *