Good day
I use this script to backup my home PC to remote PC
Code:
#!/bin/bash
#Todays date in ISO-8601 format:
DAY0=`date -I`
#Yesterdays date in ISO-8601 format:
DAY1=`date -I -d "1 day ago"`
#The source directory:
SRC="/home/honza/Downloads/"
#The target directory:
TRG="honza@192.168.80.197:/media/zaloha/$DAY0"
#The link destination directory:
LNK="/media/zaloha/$DAY1"
#The rsync options:
OPT="-avh --delete --link-dest=/honza@192.168.80.195:/media/zaloha/$DAY1"
#Execute the backup
rsync $OPT $SRC $TRG
#29 days ago in ISO-8601 format
DAY3=`date -I -d "3 days ago"`
#Delete the backup from 29 days ago, if it exists
if [ -d /honza@192.168.80.197:/media/zaloha/$DAY3 ]
then
rm -R /honza@192.168.80.197:/media/zaloha/$DAY3
fi
I dont't know how to delete old backup than 3 days. Script works well when I backup on the same PC but not on a remote.
Code:
--link-dest arg does not exist: /honza@192.168.80.195:/media/zaloha/2013-03-15
and old backups are not deleted.
thank you
Bookmarks