[英]rsync backup files to remote server with find command
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 它在backupdirs中读取文件并将最新的2个文件修改/添加并发送到备份服务器,我已经更改了备份,现在它包括sub dires,我如何调整脚本来查找在过去2小时内修改过的文件和仅rsync这些文件,找到recursvery和rysnc输出文件
You can use find
to get a list of files modified in the last 2 hours: 您可以使用find
获取最近2小时内修改的文件列表:
find . -type f -mtime -2h
To rsync recursively, use the -r
flag. 要以递归方式进行rsync,请使用-r
标志。
All together: 全部一起:
rsync -avrc -e -i `find . -type f -mtime -2h` @${DST}:/var/backups/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.