mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-08-11 07:40:22 -04:00
add things resources from the last 5 years over machines
This commit is contained in:
parent
ac9c955e0b
commit
3efc19e1f2
77 changed files with 2327 additions and 84 deletions
23
network/check_port.sh
Normal file
23
network/check_port.sh
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/bin/bash
|
||||
# Check a whether a port is open or not
|
||||
#
|
||||
# then use the script in your tests like
|
||||
# check_port 9200
|
||||
|
||||
function check_port() {
|
||||
local host=${1} && shift
|
||||
local port=${1} && shift
|
||||
local retries=5
|
||||
local wait=1
|
||||
|
||||
until( nc -zv "${host}" "${port}" ); do
|
||||
((retries--))
|
||||
if [ $retries -lt 0 ]; then
|
||||
echo "Service ${host}:${port} didn't become ready in time."
|
||||
exit 1
|
||||
fi
|
||||
sleep "${wait}"
|
||||
done
|
||||
}
|
||||
|
||||
check_port "localhost" "$@"
|
Loading…
Add table
Add a link
Reference in a new issue