Reputation: 4941
im using this ( part of my script) to do backup remotly
backupservers="mybackupserver1.server.com mybackupserver2.server.com "
BACKUP_DIR="/var/backups/"
cd ${BACKUP_DIR}
for DST in ${backupservers}
do
rsync -av -e -i `ls-1t | head -2` @${DST}:/var/backups/
done
its read files in backupdirs and take latest 2 files modified/added and send them to backup servers , ive changed backupdirs now it include sub dires , how i can adjust the script to do find files which modified in last 2 hrs and rsync these files only , find recursvery and rysnc output files
Upvotes: 0
Views: 2694
Reputation: 4999
You can use find
to get a list of files modified in the last 2 hours:
find . -type f -mtime -2h
To rsync recursively, use the -r
flag.
All together:
rsync -avrc -e -i `find . -type f -mtime -2h` @${DST}:/var/backups/
Upvotes: 2