#tcp #unix #socket #uds #wait-for-it

bin+lib wait-service

Wait Service is a pure rust program to test and wait on the availability of multiple services

12 releases

0.2.7 Nov 4, 2022
0.2.6 Mar 19, 2022
0.2.3 Feb 9, 2022
0.2.2 Nov 6, 2021
0.1.6 Oct 25, 2021

#1659 in Command line utilities

Download history 6/week @ 2022-11-22 7/week @ 2022-12-06 13/week @ 2022-12-13 3/week @ 2022-12-27 2/week @ 2023-01-10 10/week @ 2023-01-17 18/week @ 2023-01-24 6/week @ 2023-01-31 80/week @ 2023-02-07 60/week @ 2023-02-14 19/week @ 2023-02-21 2/week @ 2023-03-07

83 downloads per month

MIT license

15KB
325 lines

Wait Service

CI

Wait Service is a pure rust program to test and wait on the availability of multiple services.

Help

EXAMPLES:
wait-service --tcp localhost:27017 --tcp localhost:27018   -t 5 -- npm start  # Wait for localhost:27017 and localhost:27018 (max 5 seconds) and then run `npm start`
wait-service --tcp localhost:27017 --uds /var/run/app.sock -t 0 -- npm start  # Wait for localhost:27017 and /var/run/app.sock (forever) and then run `npm start`
wait-service --uds /var/run/app.sock --json /path/to/json       -- npm start  # Wait for /var/run/app.sock and other services defined in the json file (max 60 seconds) and then run `npm start`

USAGE:
    wait-service [OPTIONS] <COMMAND>...

ARGS:
    <COMMAND>...    Command to execute after service is available

OPTIONS:
    -t, --timeout <TIMEOUT>    Set the timeout in seconds, zero for no timeout [default: 60]
        --tcp <TCP>...         Test and wait on the availability of TCP services
        --uds <UDS>...         Test and wait on the availability of UDS services [aliases: unix]
    -h, --help                 Print help information
    -V, --version              Print version information

The Config File

With the --json option, you can input one or more JSON files to import your TCP / UDS services. The content of each file needs to be a JSON array of objects.

For a TCP service, the object format is

{
    "host": "example.com",
    "port": 443
}

For a UDS service, the object format is

{
    "uds": "/path/to/socket_file"
}

License

MIT

Dependencies

~8–15MB
~283K SLoC