同步脚本便利三个目录的内容,提前做好免秘钥登录,将源目录数据同步到另外一台服务器的相同结构下目录,脚本内容如下:
[root@IDC-D-5857 ~]# cat gz-bj.sh #!/bin/bash for i in /usr/local/boss/files/cc/2017*;do rsync -avzupog --progress --bwlimit=5120 -e "ssh -p30022" $i www@10.20.0.2:/usr/local/boss/files/cc/ echo "${i} 在 `date +%Y-%m-%d_%H:%M:%S` 同步完成" >> /root/boss_files_cc.txt done for i in /usr/ftp_home/hetong/2017*;do rsync -avzupog --progress --bwlimit=5120 -e "ssh -p30022" $i www@10.20.0.2:/usr/ftp_home/hetong/ echo "${i} 在 `date +%Y-%m-%d_%H:%M:%S` 同步完成" >> /root/ftp_home_hetong.txt done for i in /usr/ftp_home/cc/2017*;do rsync -avzupog --progress --bwlimit=5120 -e "ssh -p30022" $i www@10.20.0.2:/usr/ftp_home/cc/ echo "${i} 在 `date +%Y-%m-%d_%H:%M:%S` 同步完成" >> /root/ftp_home_cc.txt done