#tcp-socket #unix #unix-socket #tcp #uds #sockets #json-file

bin+lib wait-service

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

15 releases

0.3.1 Nov 14, 2023
0.3.0 Nov 13, 2023
0.2.8 Sep 11, 2023
0.2.7 Nov 4, 2022
0.1.6 Oct 25, 2021

#1408 in Command line utilities

Download history 875/week @ 2024-07-23 707/week @ 2024-07-30 123/week @ 2024-08-06 674/week @ 2024-08-13 472/week @ 2024-08-20 184/week @ 2024-08-27 475/week @ 2024-09-03 88/week @ 2024-09-10 1/week @ 2024-09-17 20/week @ 2024-09-24 261/week @ 2024-10-01 170/week @ 2024-10-08 150/week @ 2024-10-15 99/week @ 2024-10-22 174/week @ 2024-10-29 147/week @ 2024-11-05

573 downloads per month

MIT license

16KB
303 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>...

Arguments:
  <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]
      --json <JSON>...     Test and wait on the availability of TCP or UDS services
  -h, --help               Print help
  -V, --version            Print version

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

~7–17MB
~241K SLoC