Skip to content

🦀 Wait for one or more services (TCP port) to be available before executing a command; Rust version of wait-for-it

License

Notifications You must be signed in to change notification settings

hartwork/rust-for-it

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

🦀 Wait for one or more services (TCP port) to be available before executing a command; Rust version of wait-for-it

Topics

Resources

License

Stars

Watchers

Forks

Languages