Skip to content

pwt ("port wait") is a liveness or readyness probe that waits on the client-side until an upstream tcp port becomes available.

License

Notifications You must be signed in to change notification settings

simonmittag/pwt

Repository files navigation

pwt ("port wait") is a commandline utility that blocks until a tcp socket, aka port becomes available. Designed to replace the bash sleep command in your CI/CD scripts, this process will exit with 0 once the socket connects, or -1 in the event of a timeout.

Circleci Builds Github Workflows Github Issues Github Activity
CodeClimate Maintainability CodeClimate Test Coverage Go Version License Version

What's New

v0.1.7

  • -h -v flags for cli
  • bumped to go 1.20

Up and running

Homebrew

brew tap simonmittag/cli &&
  brew install pwt &&
  pwt 

Golang

git clone https://github.com/simonmittag/pwt && cd pwt && 
go install github.com/simonmittag/pwt/cmd/pwt && 
pwt 

Usage

λ pwt[v0.1.7]
Usage: pwt [-v]|[-w n] host[:port]
  -h    print usage instructions
  -v    print pwt version
  -w int
        time wait in seconds (default 10)

Examples

Wait for ipv4 localhost on default port

λ pwt 127.0.0.1
  pwt waiting for 127.0.0.1:80 .......... aborted after 10 seconds  

Wait for ipv6 localhost on port 8080 for 3 seconds

λ pwt -w 3 [::1]:8080
  pwt waiting for [::1]:8080 .. connected in 2 seconds

Wait for google on port 443

λ pwt -w 60 google.com:443
  pwt waiting for google.com:443 connected in <1 second  

Contributions

The pwt team welcomes all contributors. Everyone interacting with the project's codebase, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct