{"id":13552375,"url":"https://github.com/eficode/wait-for","last_synced_at":"2025-09-27T10:31:34.780Z","repository":{"id":37837217,"uuid":"90058566","full_name":"eficode/wait-for","owner":"eficode","description":"./wait-for is a script to wait for another service to become available.","archived":false,"fork":true,"pushed_at":"2024-09-12T13:46:17.000Z","size":1519,"stargazers_count":1902,"open_issues_count":5,"forks_count":409,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-09-21T17:15:15.743Z","etag":null,"topics":["automation","bash","bats","ci","docker","script","wait"],"latest_commit_sha":null,"homepage":"https://raw.githubusercontent.com/eficode/wait-for/master/wait-for","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mrako/wait-for","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eficode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-05-02T17:14:25.000Z","updated_at":"2024-09-18T02:51:50.000Z","dependencies_parsed_at":"2023-02-14T07:45:30.499Z","dependency_job_id":"c43d30ab-b67a-4822-aab6-d7431ce9c385","html_url":"https://github.com/eficode/wait-for","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fwait-for","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fwait-for/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fwait-for/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eficode%2Fwait-for/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eficode","download_url":"https://codeload.github.com/eficode/wait-for/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219871973,"owners_count":16554475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","bash","bats","ci","docker","script","wait"],"created_at":"2024-08-01T12:02:03.009Z","updated_at":"2025-09-27T10:31:29.489Z","avatar_url":"https://github.com/eficode.png","language":"Shell","readme":"\u003cbr /\u003e\n\u003ch1 align=\"center\"\u003ewait-for\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n\n  \u003cp align=\"center\"\u003e\n     Wait for another service to become available\n  \u003cbr/\u003e\n\n  \u003ca href=\"https://github.com/Eficode/wait-for/graphs/contributors\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/contributors/Eficode/wait-for.svg?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Eficode/wait-for/network/members\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/forks/Eficode/wait-for.svg?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Eficode/wait-for/stargazers\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/stars/Eficode/wait-for.svg?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Eficode/wait-for/blob/master/LICENSE.txt\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/Eficode/wait-for.svg?style=flat-square\"\u003e\n  \u003c/a\u003e \n  \u003ca href=\"https://github.com/Eficode/wait-for/actions\"\u003e\n  \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/Eficode/wait-for/ci.yml?style=flat-square\u0026logo=github%20actions\"\u003e\n  \u003c/a\u003e \n  \u003ca href=\"https://github.com/Eficode/wait-for/releases\"\u003e\n  \u003cimg alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/Eficode/wait-for?style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/Eficode/wait-for/releases\"\u003e\n  \u003cimg alt=\"Script file size\" src=\"https://img.shields.io/github/size/eficode/wait-for/wait-for?style=flat-square\u0026color=green\"\u003e\n  \u003c/a\u003e\n    \n  \u003cbr/\u003e\n  \n  \u003ca href=\"https://hub.docker.com/r/eficode/wait-for\"\u003e\n  \u003cimg alt=\"Docker Pulls\" src=\"https://img.shields.io/docker/pulls/eficode/wait-for?label=pulls\u0026logo=docker\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://hub.docker.com/r/eficode/wait-for\"\u003e\n  \u003cimg alt=\"Docker Image Size (latest semver)\" src=\"https://img.shields.io/docker/image-size/eficode/wait-for?image%20size=pulls\u0026logo=docker\u0026style=flat-square\"\u003e\n  \u003c/a\u003e\n  \u003cbr/\u003e\n  \u003ca href=\"https://github.com/eficode/wait-for#examples\"\u003e\u003cstrong\u003eExample usage\u003c/strong\u003e\u003c/a\u003e\n  ·\n  \u003ca href=\"https://github.com/Eficode/wait-for/pulls\"\u003eSubmit a PR\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n`./wait-for` is a script designed to synchronize services like docker containers. It is [sh](https://en.wikipedia.org/wiki/Bourne_shell) and [alpine](https://alpinelinux.org/) compatible. It was inspired by [vishnubob/wait-for-it](https://github.com/vishnubob/wait-for-it), but the core has been rewritten at [Eficode](http://eficode.com/) by [dsuni](https://github.com/dsuni) and [mrako](https://github.com/mrako).\n\nThe easiest way to get started using this tool is to include the `wait-for` file as part of your project. Then call this script as part of any automation script.\n\n## Usage\n\n### Locally\n\nDownload the `wait-for` file, either the latest from [`master`](https://raw.githubusercontent.com/eficode/wait-for/master/wait-for) or for a specific version check out the [Releases](https://github.com/eficode/wait-for/releases)-page.\n\nWith the file locally on your file system, you can directly invoke it.\n\n```\n./wait-for host:port|url [-t timeout] [-- command args]\n  -q | --quiet                        Do not output any status messages\n  -t TIMEOUT | --timeout=timeout      Timeout in seconds, zero for no timeout\n                                      Defaults to 15 seconds\n  -v | --version                      Show the version of this tool\n  -- COMMAND ARGS                     Execute command with args after the test finishes\n```\n\nAlternatively, you could download the script and pipe it into `sh`:\n\n```sh\n$ wget -qO- https://raw.githubusercontent.com/eficode/wait-for/v2.2.3/wait-for | sh -s -- google.com:80 -- echo success\n```\n\n_Note: When using the latter option, make sure to pin the version by commit hash. Future releases could introduce non-backwards compatible changes and leaves you vulnerable to malicious users modifying this script in the future (as has e.g. [happened with Codecov](https://about.codecov.io/security-update/))._\n\n### GitHub Actions\n\nSimilarly to how we piped the script into our shell covered in local usage, we can also use this in GitHub Actions, like so:\n\n```yaml\n      - name: Wait for the database to start\n        run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- localhost:5132 -- echo \"Database is up\"\n        env:\n          WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3\n```\n\n### Docker\n\nWe also publish a container to Docker Hub at [`eficode/wait-for`](https://hub.docker.com/r/eficode/wait-for), where we publish under the tag `latest` what's in `master` and tags for each release. (Only tags newer van v2.2.3 are available.) You can use the container like this:\n\n```bash\n$ docker run --rm eficode/wait-for google.com:80 -- echo success\nsuccess\n```\n\n_Note: We will refrain from changes in the container we are publishing from triggering releases, as our primary distributable remains the script itself. One exception might be urgent security fixes._\n\n## Examples\n\nTo check if [www.eficode.com](https://www.eficode.com) is available:\n\n```\n$ ./wait-for www.eficode.com:80 -- echo \"Eficode site is up\"\nEficode site is up\n```\n\nTo wait for database container to become available:\n\n```yml\nversion: \"3\"\n\nservices:\n  db:\n    image: postgres:9.4\n\n  backend:\n    build: backend\n    command: sh -c './wait-for db:5432 -- npm start'\n    depends_on:\n      - db\n```\n\nTo check if [https://www.eficode.com](https://www.eficode.com) is available over HTTPS:\n\n```\n$ ./wait-for https://www.eficode.com -- echo \"Eficode is accessible over HTTPS\"\nEficode is accessible over HTTPS\n```\n\nTo wait for your API service to become available:\n\n```yml\nversion: \"3\"\n\nservices:\n  api:\n    image: nginx\n\n  tests:\n    build: .\n    command: sh -c './wait-for http://api -- echo \"The api is up! Let's use it\"'\n    depends_on:\n      - api\n```\n\n## Testing\n\nTesting is done using [bats](https://github.com/bats-core/bats-core), which we install using [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm). \n\nFor reproducibility, we run our tests inside Docker, such that we have control over the version of [bash](\u003chttps://en.wikipedia.org/wiki/Bash_(Unix_shell)\u003e) we're testing against.\n\n```bash\ndocker build --target test-env --tag wait-for .\ndocker run --rm -t wait-for\n```\n\n## Contributing\n\nWhen creating PRs, please style your commit messages according to [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/), you can use a tool like [commitizen](https://github.com/commitizen/cz-cli) to guide you. We will automatically infer the changelog from your commits. Alternatively, we can squash all commits when merging and update the commit message.\n\nThis project strongly prefers maintaining backwards compatibility, therefore some obvious \"fixes\" might not be accepted.\n\nAlso, please include or update the test cases whenever possible by extending `wait-for.bats`.\n\n## Note\n\nMake sure netcat is installed in your Dockerfile before running the command if you test over plain TCP.\n\n```\nRUN apt-get -q update \u0026\u0026 apt-get -qy install netcat\n```\n\nhttps://stackoverflow.com/questions/44663180/docker-why-does-wait-for-always-time-out\n\nIf you are connecting over HTTP, then you will need to have wget available.\n","funding_links":[],"categories":["Misc","Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feficode%2Fwait-for","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feficode%2Fwait-for","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feficode%2Fwait-for/lists"}