疎通待ち
shimizukawa.icon人類はいつまでshell scriptに頼るのだろうか...
curl -w でデバッグ表示付き
code:bash
echo -n "Waiting for HTTPS status 200 ..."; while ! curl -q https://site/ -w '%{http_code}\n' -f -s -o /dev/null; do echo -n "."; sleep 1; done; echo "ok"
code:console
Waiting for HTTPS status 200 ...502
.502
.502
.502
.200
ok
python3
code:bash
echo -n "Waiting for HTTPS status 200 ..."; while ! python3 -c "exit(__import__('urllib.request').request.urlopen('https://site/').status!=200)" >/dev/null 2>&1; do echo -n "."; sleep 1; done; echo "ok"
もうちょっと良い書き方ないかなあ
Makefileでecho -nが使えない場合は/bin/echoを使う。