Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wait for connection on local address only #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 9 additions & 5 deletions files/glbd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ else
fi

wait_for_connections_to_drop() {
while (netstat -na | grep -m 1 ":$LISTEN_PORT " > /dev/null); do
echo "[`date`] $prog: waiting for lingering sockets to clear up..."
sleep 1s
done;
return 0
_LISTEN_ADDR=$LISTEN_ADDR
if [ "$_LISTEN_ADDR" = "$LISTEN_PORT" ]; then
_LISTEN_ADDR=":"$LISTEN_PORT
fi
while (netstat -na | awk '{ print $4 }' | grep "$_LISTEN_ADDR" > /dev/null); do
echo "[`date`] $prog: waiting for lingering sockets to clear up..."
sleep 1s
done;
return 0
}

stop() {
Expand Down