Skip to content

Instantly share code, notes, and snippets.

@mumoshu
Created April 21, 2014 06:43
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mumoshu/11134210 to your computer and use it in GitHub Desktop.
Save mumoshu/11134210 to your computer and use it in GitHub Desktop.
trial=0; until apt-get update -y || [ $trial -eq 4 ]; do sleep $((2**++trial )); done
@mumoshu
Copy link
Author

mumoshu commented Apr 21, 2014

いまのところ数分あけるとうまくいくことが多いようなので、
5_2_*trial++などとして、5の部分を適当にかえると

リトライ1回目: 5秒
リトライ2回目: 10秒
リトライ2回目: 20秒
リトライ2回目: 40秒
のように倍々に待ち時間が増えていい感じかもしれません

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment