backup at a date with hard links rsync

#!/bin/bash

if [ -z "$1" ]; then
  echo -n "Usage: just as a control " $0
  echo "   <input> "
  exit 1
fi

### Add to the whole backup
#cd /home/
#nice -19 rsync --progress -a --partial \
--exclude-from="/home/karthik/.sexclude_2011.txt" \
karthik /media/EXT4_900GB/data/RISHI
#cd /software
#nice -19 rsync --progress -a --bwlimit=800 --partial  linuxsoft /media/EXT4_900GB/data/RISHI

#exit

### do this only when you want to format and restore to a particular date.

new_dir=`date +%F`
mkdir /media/EXT4_900GB/data/RISHI/karthik-"$new_dir"

cd /home/
rsync --archive --hard-links --progress  \
  --human-readable \
  --exclude-from="/home/karthik/.exclude_2011.txt" \
  --link-dest=/media/EXT4_900GB/data/RISHI/karthik \
  /home/karthik/ /media/EXT4_900GB/data/RISHI/karthik-"$new_dir"
 


#Another solution where current is the latest backup created.
#in the second command, ssh username@host is 
#NOT followed by colon:
#
#!/bin/bash
 
date=`date "+%Y-%m-%d"`
rsync -azP --link-dest=/path/to/home/backups/current \
/path/to/source/folder \
username@host:/path/to/home/backups/backup-$date

ssh username@host "rm -f /path/to/home/backups/current \
ln -s  /path/to/home/backups/backup-$date \
/path/to/home/backups/current  "