Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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 | --version

Options:
-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