mirror of
https://github.com/autistic-symposium/shell-whiz-toolkit.git
synced 2025-05-13 12:12:25 -04:00
move shell scripts and zsh and add fav vscode themes
This commit is contained in:
parent
40077637ce
commit
e6794a8954
43 changed files with 55 additions and 34 deletions
23
shell/shell_scripts/check_port_network.sh
Normal file
23
shell/shell_scripts/check_port_network.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