Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kung-foo/waitforit
waitforit is a command line utility and library for delaying a script until a requisite service is available.
https://github.com/kung-foo/waitforit
Last synced: 22 days ago
JSON representation
waitforit is a command line utility and library for delaying a script until a requisite service is available.
- Host: GitHub
- URL: https://github.com/kung-foo/waitforit
- Owner: kung-foo
- License: apache-2.0
- Created: 2015-08-03T19:14:17.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-16T14:58:26.000Z (about 9 years ago)
- Last Synced: 2024-06-19T16:46:24.719Z (5 months ago)
- Language: Go
- Homepage:
- Size: 492 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# waitforit
**waitforit** is a command line utility and library for delaying a script until a requisite service is available.
For example, when using docker-compose, it is common that entrypoint scripts need to wait until the database container has started and been initialized.
Initializing a nodejs server container that depends on a Postrgres instance with a database called *ghost*:
```sh
#!/usr/bin/env sh
set -ex
waitforit -k -r 60 postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@db:5432/ghost
exec npm start --production
```## Usage
```
Usage:
waitforit [options] [--exists=]
waitforit -h | --help | --versionOptions:
-h --help Show this screen.
-s, --silent Silent
-t, --timeout= Maximum time per attempt [default: 5s]
Valid time units are "ns", "us" (or "µs"), "ms",
"s", "m", "h"
-r, --retry= Number of times to retry after failure [default: 5]
Set to -1 to always retry
--retry-delay= Time to wait before retrying [default: 1s]
Valid time units are "ns", "us" (or "µs"), "ms",
"s", "m", "h"
--exists= Wait for item to exist
For redis, this is waits for the key to exist
For DBs, this waits for the table to exist
-k, --insecure Disable SSL certificate validation
--expand-env Expand environmental variables in URI
--version Show version.URI Examples:
redis://127.0.0.1
redis://[email protected]/7
http://username:[email protected]:8080/hello
mysql://scott:[email protected]/ghost
postgres://ghost:[email protected]/ghost
```Downloads
---------See https://github.com/kung-foo/waitforit/releases