rsync -auHzSv --ignore-errors --partial --delete-excluded --bwlimit=
256 --password-file=/etc/rsync.pas --include
`date
"+%Y/%m"`"/
" --include `date "+
%Y/%m
" -d "-
1 month
"`"/" --include
`date
"+%Y/%m" -d
"-2 month"`"/
" --include `date "+
%Y/%m
" -d "-
3 month
"`"/" --exclude
"2016/*" --exclude
"2017/*" /home/www/image23.baidu.com/image23/o_img/ rsync://rsyncback@
111.111.
111.111/
222.222.
222.222_image23
脚本如上面的,需求: 备份最近四个月的图片数据 目录命名 /home/www/image23.baidu.com/image23/o_img/2017/03 /home/www/image23.baidu.com/image23/o_img/2016/12这样的规则 所以我源目录设置到了年份的上一级 include 我用了 date date "+%Y/%m"“/” 本月的加个反斜杠 date "+%Y/%m" -d "-1 month"“/” date "+%Y/%m" -d "-2 month"“/” date "+%Y/%m" -d "-3 month"“/” exclude 因为只有2016和2017两年的目录,暂时写死, “2016/*” “2017/*”
转载请注明原文地址: https://ju.6miu.com/read-1697.html