#!/bin/bash # directory to backup BDIR="$HOME /etc" # excludes file - this contains a wildcard pattern per line of files to exclude EXCLUDES="$HOME/cron/excludes" BDEST=`mount | grep sdb1 | awk '{print $3}'`/backup ######################################################################## LANG="C" BACKUPDIR=`date +%A` OPTS="-v --force --ignore-errors --delete-excluded --exclude-from=$EXCLUDES --delete --backup --backup-dir=$BDEST/$BACKUPDIR -a" export PATH=$PATH:/bin:/usr/bin:/usr/local/bin # the following line clears the last weeks incremental directory [ -d /tmp/emptydir ] || mkdir /tmp/emptydir rsync --delete -a /tmp/emptydir/ $BDEST/$BACKUPDIR rmdir /tmp/emptydir # now the actual transfer rsync $OPTS $BDIR $BDEST/current