rsync並行上傳多文件腳本

#!/bin/bash
export SRCDIR=/Data/data_ftp/ftpuser/
export DESHOST=10.203.137.73
export DESTDIR=elite13773
export THREADS=5
export rsync_more_opts="-avP --bwlimit=5120 --partial-dir=.rsync-tmp --timeout=20 --password-file=/etc/rsyncd.pass_1986 --exclude-from=/etc/rsyncd.exclude_file"

######################## module 1, receive, from WH - 10.203.137.73, to Local
# step 1
#run at server 10.203.137.73
#cd /Data/data_ftp/ftpuser; find . -type f -size +30M -ctime -3 | egrep -i "iso$|zip$|gz$" > /Data/data_ftp/ftpuser/2014/it/large_file_list_2LH
#cd /Data/data_ftp/ftpuser; find . -type f -size +30M -ctime -3 > /Data/data_ftp/ftpuser/2014/it/large_file_list_2LH

rsync $rsync_more_opts macjsync@$DESHOST::$DESTDIR/2014/it/ $SRCDIR/2014/it
cat /Data/data_ftp/ftpuser/2014/it/large_file_list_2LH | xargs -n3 -P$THREADS -I% rsync $rsync_more_opts --relative --log-file=/var/log/rsync-13773-1.log macjsync@$DESHOST::$DESTDIR/% $SRCDIR

# step 2
rsync --max-size=50M $rsync_more_opts --log-file=/var/log/rsync-13773-2.log macjsync@$DESHOST::$DESTDIR $SRCDIR


####################### module 2, sent, from Local to WH - 10.203.137.73
# step 3
cd /Data/data_ftp/ftpuser; find . -type f -size +30M -ctime -3 > /Data/data_ftp/ftpuser/2014/it/large_file_list_2WH
chown ftpuser.ftpgroup /Data/data_ftp/ftpuser/2014/it/large_file_list_2WH
cat /Data/data_ftp/ftpuser/2014/it/large_file_list_2WH | xargs -P$THREADS -I% rsync $rsync_more_opts --relative % --log-file=/var/log/rsync-13773-3.log macjsync@$DESHOST::$DESTDIR

# step 4
rsync --max-size=50M $rsync_more_opts --log-file=/var/log/rsync-13773-4.log $SRCDIR macjsync@$DESHOST::$DESTDIR
相關文章
相關標籤/搜索