Skip to content

A script that waits for a specific service to be up and running before it returns or terminates early if giving up trying

Notifications You must be signed in to change notification settings

PerArneng/waitforservice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

A script that waits for a specific service to be up and running before it returns. A typical usecase would be for services that needs to be started in a certain order. A typical scanrio for this is synchronising Docker containers.

Example

$ waitforservice -n google -u http://www.google.com -c 10 -s 2000

Tries to get a 200 response from the given URL by trying it 10 times with 2s inbetween

Usage

  usage: waitforservice [-h] -n [NAME] -u [URL] [-c [COUNT]] [-s [SLEEP]]

  optional arguments:
    -h, --help            show this help message and exit
    -n [NAME], --name [NAME]
                        the name of the service to wait for
    -u [URL], --url [URL]
                        the url ex: tcp://<host>:<port> or http://...
    -c [COUNT], --count [COUNT]
                        the nr of times to try. less than 1 means forever.
                        default = 100
    -s [SLEEP], --sleep [SLEEP]
                        sleep time in ms between tries. default = 1s

About

A script that waits for a specific service to be up and running before it returns or terminates early if giving up trying

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages