https://github.com/hartwork/rust-for-it
:crab: Wait for one or more services (TCP ports) to be available before executing a command; Rust version of wait-for-it
https://github.com/hartwork/rust-for-it
command-line-tool rust rust-application tcp wait-for-it
Last synced: 3 months ago
JSON representation
:crab: Wait for one or more services (TCP ports) to be available before executing a command; Rust version of wait-for-it
- Host: GitHub
- URL: https://github.com/hartwork/rust-for-it
- Owner: hartwork
- License: mit
- Created: 2023-06-04T18:46:08.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2026-01-23T16:18:12.000Z (3 months ago)
- Last Synced: 2026-01-24T07:18:24.223Z (3 months ago)
- Topics: command-line-tool, rust, rust-application, tcp, wait-for-it
- Language: Rust
- Homepage:
- Size: 416 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/hartwork/rust-for-it/actions/workflows/build_and_test.yml)
[](https://github.com/hartwork/rust-for-it/actions/workflows/enforce_rustfmt.yml)
# rust-for-it
## About
**rust-for-it** is a lookalike of
(the perfectly fine)
Python [wait-for-it](https://github.com/clarketm/wait-for-it)
written in Rust 1.69+.
It supports waiting for multiple services concurrently by default,
and has a test coverage of >90%.
If you do find bugs, [please file a report](https://github.com/hartwork/rust-for-it/issues).
Thank you!
## Build and run
```console
$ cargo run -- --help
```
… or …
```console
$ cargo build
$ export PATH="${PWD}/target/debug:${PATH}"
$ rust-for-it --help
```
## Examples
```console
$ rust-for-it -t 2 -s [::1]:631 -s localhost:631 -s 127.0.0.1:631 -- echo 'CUPS is very available'
[*] Waiting 2 seconds for localhost:631...
[*] Waiting 2 seconds for [::1]:631...
[+] [::1]:631 is available after 0 seconds.
[*] Waiting 2 seconds for 127.0.0.1:631...
[+] 127.0.0.1:631 is available after 0 seconds.
[+] localhost:631 is available after 0 seconds.
CUPS is very available
```
## Usage
```console
$ rust-for-it --help
Wait for one or more services to be available before executing a command.
Usage: rust-for-it [OPTIONS] [command]...
Arguments:
[command]... Command to run after waiting;
includes command arguments, resolved against ${PATH}
Options:
-q, --quiet Do not output any status messages
-S, --strict Only execute if all services are found available [default: always executes]
-t, --timeout Timeout in seconds, 0 for no timeout [default: 15]
-s, --service [...] Service to test via the TCP protocol; can be passed multiple times
-h, --help Print help
-V, --version Print version
```
## Alternatives
### Go
- [`github.com/alioygur/wait-for`](https://github.com/alioygur/wait-for)
- [`github.com/hartwork/go-wait-for-it`](https://github.com/hartwork/go-wait-for-it)
- [`github.com/maxcnunes/waitforit`](https://github.com/maxcnunes/waitforit)
- [`github.com/mjeri/go-wait-for-it`](https://github.com/mjeri/go-wait-for-it)
### Python
- [`github.com/clarketm/wait-for-it`](https://github.com/clarketm/wait-for-it)
— package `wait-for-it` [on PyPI](https://pypi.org/project/wait-for-it/)
- [`github.com/David-Lor/python-wait4it`](https://github.com/David-Lor/python-wait4it/)
— package `wait4it` [on PyPI](https://pypi.org/project/wait4it/)
### Rust
- [`github.com/Etenil/wait-for-rust`](https://github.com/Etenil/wait-for-rust)
- [`github.com/hartwork/rust-for-it`](https://github.com/hartwork/rust-for-it) — the one you are looking at
- [`github.com/ktitaro/wait-for`](https://github.com/ktitaro/wait-for)
— package `wait_for` [on crates.io](https://crates.io/crates/wait_for)
- [`github.com/magiclen/wait-service`](https://github.com/magiclen/wait-service)
— package `wait-service` on [crates.io](https://crates.io/crates/wait-service)
- [`github.com/shenek/wait-for-them`](https://github.com/shenek/wait-for-them)
— package `wait-for-them` [on crates.io](https://crates.io/crates/wait-for-them)
### Shell
- [`github.com/eficode/wait-for`](https://github.com/eficode/wait-for)
— POSIX shell
- [`github.com/vishnubob/wait-for-it`](https://github.com/vishnubob/wait-for-it)
— Bash, package `wait-for-it` [in Debian](https://packages.debian.org/unstable/wait-for-it)