PHPackages                             masonitedoors/wait-for-it - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. masonitedoors/wait-for-it

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

masonitedoors/wait-for-it
=========================

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

1.0.0(6y ago)02.2kMITShell

Since Apr 23Pushed 6y agoCompare

[ Source](https://github.com/masonitedoors/wait-for-it)[ Packagist](https://packagist.org/packages/masonitedoors/wait-for-it)[ RSS](/packages/masonitedoors-wait-for-it/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

`wait-for-it.sh` 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
-----

[](#usage)

```
wait-for-it.sh 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

```

Examples
--------

[](#examples)

For example, let's test to see if we can access port 80 on [www.google.com](http://www.google.com), and if it is available, echo the message `google is up`.

```
$ ./wait-for-it.sh www.google.com:80 -- echo "google is up"
wait-for-it.sh: waiting 15 seconds for www.google.com:80
wait-for-it.sh: www.google.com:80 is available after 0 seconds
google is up

```

You can set your own timeout with the `-t` or `--timeout=` option. Setting the timeout value to 0 will disable the timeout:

```
$ ./wait-for-it.sh -t 0 www.google.com:80 -- echo "google is up"
wait-for-it.sh: waiting for www.google.com:80 without a timeout
wait-for-it.sh: www.google.com:80 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 `--strict` argument. In this example, we will test port 81 on [www.google.com](http://www.google.com) which will fail:

```
$ ./wait-for-it.sh www.google.com:81 --timeout=1 --strict -- echo "google is up"
wait-for-it.sh: waiting 1 seconds for www.google.com:81
wait-for-it.sh: timeout occurred after waiting 1 seconds for www.google.com:81
wait-for-it.sh: 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 `wait-for-it.sh` in your own scripts, and determine how to proceed:

```
$ ./wait-for-it.sh www.google.com:80
wait-for-it.sh: waiting 15 seconds for www.google.com:80
wait-for-it.sh: www.google.com:80 is available after 0 seconds
$ echo $?
0
$ ./wait-for-it.sh www.google.com:81
wait-for-it.sh: waiting 15 seconds for www.google.com:81
wait-for-it.sh: timeout occurred after waiting 15 seconds for www.google.com:81
$ echo $?
124

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2208d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d69ded7ff395fe086c58984188d0dc79a5d492aa212b038805caffbb4b89bf7c?d=identicon)[josephfusco](/maintainers/josephfusco)

![](https://www.gravatar.com/avatar/86462a839287f8f512fe9222f33d3369129aed32d9e7a7eb636489e67c5008f7?d=identicon)[ipetty](/maintainers/ipetty)

---

Top Contributors

[![vishnubob](https://avatars.githubusercontent.com/u/188410?v=4)](https://github.com/vishnubob "vishnubob (7 commits)")[![Silex](https://avatars.githubusercontent.com/u/16015?v=4)](https://github.com/Silex "Silex (1 commits)")

### Embed Badge

![Health badge](/badges/masonitedoors-wait-for-it/health.svg)

```
[![Health](https://phpackages.com/badges/masonitedoors-wait-for-it/health.svg)](https://phpackages.com/packages/masonitedoors-wait-for-it)
```

###  Alternatives

[treeware/plant

13355.9k6](/packages/treeware-plant)[aschmelyun/size

Simple PHP helper to convert bytes to different sizes

471.2k](/packages/aschmelyun-size)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
