rsync 自动重连

警告
本文最后更新于 2021-06-04,文中内容可能已过时。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
while true
do
    sleep 1
    #rsync --progress -avPz -r -e "ssh -p60001" tbt.colo101.$(date +"%Y%m")*.tar.bz2 ops@58.33.72.179:/data/Xtp/FromZZ.SH
    exitCode=$?

    ## -------------------------------------------------------------------------
    case $exitCode in
    10 | 23 | 30 | 35)
      echo "$(date): rsync finished with a network related error: $exitCode"
      ;;
    0)
      echo "$(date): rsync finished without error"
      break  # leave the while loop
      ;;
    *)  # all other cases
      echo "$(date): rsync finished with an unexpected error: $exitCode"
      ## break  # we don't know whether repeating it makes sense
      ;;
    esac
    ## -------------------------------------------------------------------------

done

相关内容

william 支付宝支付宝
william 微信微信
0%