SCP 断点续传!

来源:互联网 发布:淘宝天猫优惠券兼职 编辑:程序博客网 时间:2024/06/07 13:02

工作中,总是经常需要传输文件,有很多工具非常好用,scp、sftp等。可是这些工具没有断点续传的功能,一旦网络中断,所传的文件都白费了,还得重新传输。下面我用rsync来完成断点续传。注意下面要传的文件一定要和之前的文件一样,而且拷贝到某个主机的目录也要一致。下面是我的一个例子。

[root@johnny]# rsync -avzP file root@172.20.7.219:/root/tmp           (我这里file指要传送的文件)

Password:
building file list ...
1 file to consider
file                                                          746602496 100%  324.23kB/s    0:37:28 (xfer#1, to-check=0/1)

sent 127779788 bytes  received 170765 bytes  56279.11 bytes/sec

total size is 746602496  speedup is 5.84


 参数说明:     

  v:详细提示 

  a:以archive模式操作,复制目录、符号连接,等价于 -rlptgoD 。 

  z:压缩 

  u:只进行更新,防止本地新文件被重写,注意两者机器的时钟的同时 

  P:是综合了--partial --progress两个参数

机房之间传文件一般都担心带宽占用太多,特别是在共用带宽的情况下。常用的两个软件都可以限速: 

scp可以加上 -l 参数: 

 

引用 

     -l limit 

             Limits the used bandwidth, specified in Kbit/s. 

rsync可以加上 --bwlimit 参数 

 

引用 

        -i, --itemize-changes       output a change-summary for all updates 

            --log-format=FORMAT     output filenames using the specified format 

            --password-file=FILE    read password from FILE 

            --list-only             list the files instead of copying them 

            --bwlimit=KBPS          limit I/O bandwidth; KBytes per second 

            --write-batch=FILE      write a batched update to FILE 

            --only-write-batch=FILE like --write-batch but w/o updating dest


0 0
原创粉丝点击