我想为 rsync 备份过程设置时间限制。我怎样做才最好呢?
根据这篇文章,有一个选项可以做到这一点:
--time-limit
When this option is used rsync will stop after T minutes and exit.
Run Code Online (Sandbox Code Playgroud)
然而,我的 Ubuntu 12.04 上没有实现该选项。在帖子的评论中,暗示了一个可能的解决方案,但我不够流利,不敢自己着手,就像这样。
似乎还有时间限制命令/程序,但我也没有。也许这就是解决方案?
小智 2
老问题,但 coreutilstimeout
命令可以做到这一点(尽管它不会优雅地结束)。
timeout 60 rsync source destination
Run Code Online (Sandbox Code Playgroud)
其中 60 是以秒为单位的时间限制
小智 1
这是我修补它的方法:
wget http://mirrors.ibiblio.org/rsync/src/rsync-patches-3.0.9.tar.gz
wget http://mirrors.ibiblio.org/rsync/src/rsync-3.0.9.tar.gz
tar xvf rsync-3.0.9.tar.gz
tar xvf rsync-patches-3.0.9.tar.gz
cd rsync-3.0.9
patch -p1 <patches/time-limit.diff
./configure
make
cp ./rsync /usr/local/bin
Run Code Online (Sandbox Code Playgroud)
注意: 我必须rsync
在备份连接的两侧都打补丁。
归档时间: |
|
查看次数: |
5601 次 |
最近记录: |