Skip to content

Latest commit

 

History

History
106 lines (74 loc) · 3.64 KB

README.md

File metadata and controls

106 lines (74 loc) · 3.64 KB

Build and test Enforce rustfmt-clean code

rust-for-it

About

rust-for-it is a lookalike of (the perfectly fine) Python 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. Thank you!

Build and run

$ cargo run -- --help

… or …

$ cargo build
$ export PATH="${PWD}/target/debug:${PATH}"
$ rust-for-it --help

Examples

$ 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

$ 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 <command> if all services are found available [default: always executes]
  -t, --timeout <seconds>         Timeout in seconds, 0 for no timeout [default: 15]
  -s, --service [<host:port>...]  Service to test via the TCP protocol; can be passed multiple times
  -h, --help                      Print help
  -V, --version                   Print version

Alternatives

Go

Python

Rust

Shell