Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Allow using ss in wait-for-port #28

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion bin/service-wait
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,17 @@ wait-for-url () {

wait-for-port () {
success=0
if which ss 2>&1 > /dev/null ; then
local cmd="ss -ln"
elif which netstat 2>&1 > /dev/null ; then
local cmd="netstat -ln"
else
# We can't really check if the port is available so we assume it's ok
return # SUCCESS
fi

for i in $(seq 1 $WAIT_MAX); do
if netstat -ln | grep -q ":$1\s"; then
if $cmd | grep -q ":$1\s"; then
return # SUCCESS
else
service-wait-sleep
Expand Down