Skip to content

hongquan/wait-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

wait-server

Tool (as Bash script) to wait for a server to be online (connectable), in a certain duration.

Usage

wait-server 8000

is to wait for a server at port 8000, on localhost to be online. After 5 seconds, the program will exit with error.

Full options:

wait-server [[HOST] PORT] [-t <timeout>][-q][-h]

where:

  • HOST: Host name or IP address of server. Default is localhost.
  • PORT: Port where the server is listening. Default is 8000.
  • t: Timeout. Default is 5s.
  • q: Quiet, don't show progress dots.

Main purpose of this tool, is to be used in a systemd service, to delay the service until some server is online. For example, you have service-a and service-b, in which service-a is a server software that takes long time to initialize (often Java application), and service-b should be run only after service-a is ready. You can write the systemd service file like this:

[Unit]
After=service-a.service

[Service]
ExecStartPre=/usr/bin/wait-server
ExecStart=/usr/bin/application-b

The mainpage documentation is to be generated by pandoc.

Releases

No releases published

Packages

No packages published

Languages