wait-for-port

command module
v1.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

CI

wait-for-port

This tool allows waiting for a port to enter into the requested state (free or in use), with a customizable timeout

Basic usage

$ wait-for-port --help
Usage:
  wait-for-port [OPTIONS] port

Application Options:
  -h, --host=HOST             Host where to check for the port
  -s, --state=[inuse|free]    State to wait for (default: inuse)
  -t, --timeout=SECONDS       Timeout in seconds to wait for the port (default: 30)

Help Options:
  -h, --help                  Show this help message

Examples

Wait for a port to be in use

$ wait-for-port --state=inuse 12345
$ echo $?
0

Or in a remote server:

$ wait-for-port --host=myhost.example.com --state=inuse 12345
$ echo $?
0

Wait for a port to be free

$ wait-for-port --state=free 12345
$ echo $?
0

Or in a remote server:

$ wait-for-port --host=myhost.example.com --state=free 12345
$ echo $?
0

The tool times out before the port goes into the required state

If the port does not go into the required state under the provided timeout time, the process will retur a non-zero exit code so it is easily recognizable from a parent process:

$ wait-for-port --timeout=10 --state=inuse 13456
timeout reached before the port went into state "inuse"
$ echo $?
1
$ wait-for-port --timeout=10 --state=free 8080
timeout reached before the port went into state "free"
$ echo $?
1

License

Copyright © 2023 VMware, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL