假設我正在執行一個名為run.sh. 我在這個檔案中有這個命令:
SERVER=${SERVER:-"localhost:5555"}
wait-for-it ${SERVER}
當我echo時${SERVER},我可以看到它已正確設定為newserver:5555。當我運行run.sh檔案時,我收到此錯誤:
Command 'newserver:5555' not found
我究竟做錯了什么?
更新:“等待它是一個腳本,它將在執行用戶定義的命令之前等待一個或多個 TCP 服務(即主機:埠)的可用性。”
uj5u.com熱心網友回復:
從您鏈接的等待它的網站:
Usage: wait-for-it [OPTIONS] [COMMANDS]...
Wait for service(s) to be available before executing a command.
Options:
-h, --help Show this message and exit.
-v, --version Show the version and exit.
-q, --quiet Do not output any status messages
-p, --parallel Test services in parallel rather than in serial
-t, --timeout seconds Timeout in seconds, 0 for no timeout [default: 15]
-s, --service host:port Services to test, in one of the formats: ':port',
'hostname:port', 'v4addr:port', '[v6addr]:port' or
'https://...'
所以你可能想要:
SERVER=${SERVER:-"localhost:5555"}
wait-for-it --service ${SERVER}
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/449200.html
