Need help with wait-for-it?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

7.0K Stars 2.0K Forks MIT License 49 Commits 68 Opened issues


Pure bash script to test and wait on the availability of a TCP host and port

Services available


Need anything else?

Contributors list

is a pure bash script that will wait on the availability of a host and TCP port. It is useful for synchronizing the spin-up of interdependent services, such as linked docker containers. Since it is a pure bash script, it does not have any external dependencies.

Usage host:port [-s] [-t timeout] [-- command args]
-h HOST | --host=HOST       Host or IP under test
-p PORT | --port=PORT       TCP port under test
                            Alternatively, you specify the host and port as host:port
-s | --strict               Only execute subcommand if the test succeeds
-q | --quiet                Don't output any status messages
-t TIMEOUT | --timeout=TIMEOUT
                            Timeout in seconds, zero for no timeout
-- COMMAND ARGS             Execute command with args after the test finishes


For example, let's test to see if we can access port 80 on
, and if it is available, echo the message
google is up
$ ./ -- echo "google is up" waiting 15 seconds for is available after 0 seconds
google is up

You can set your own timeout with the

option. Setting the timeout value to 0 will disable the timeout:
$ ./ -t 0 -- echo "google is up" waiting for without a timeout is available after 0 seconds
google is up

The subcommand will be executed regardless if the service is up or not. If you wish to execute the subcommand only if the service is up, add the

argument. In this example, we will test port 81 on
which will fail:
$ ./ --timeout=1 --strict -- echo "google is up" waiting 1 seconds for timeout occurred after waiting 1 seconds for strict mode, refusing to execute subprocess

If you don't want to execute a subcommand, leave off the

argument. This way, you can test the exit condition of
in your own scripts, and determine how to proceed:
$ ./ waiting 15 seconds for is available after 0 seconds
$ echo $?
$ ./ waiting 15 seconds for timeout occurred after waiting 15 seconds for
$ echo $?


Debian: There is a Debian package.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.