Skip to content

Commit

Permalink
Merge pull request #129 from Krishnendu2460/updated_script
Browse files Browse the repository at this point in the history
Fixed negative counting
  • Loading branch information
biplamal authored Dec 6, 2024
2 parents b9a4859 + 23876df commit cab1ecd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions do.sh
Original file line number Diff line number Diff line change
Expand Up @@ -589,20 +589,20 @@ wait_for_sock() {
then
TIMEOUT_SECONDS=${3}
fi
echo "Waiting for ${1}:${2} to be ready (timeout=${TIMEOUT_SECONDS}s)..."
start_time=$(date +%S)
elapsed=0
TIMEOUT_SECONDS=$(($TIMEOUT_SECONDS * 10))
while true
do
nc -z -v ${1} ${2} && return 0
current_time=$(date +%S)
elapsed=$(( current_time - start_time ))
echo "elapsed time: $elapsed"
elapsed=$(($elapsed+1))
# echo "Timeout: $TIMEOUT_SECONDS"
# echo "elapsed time: $elapsed"
if [ $elapsed -gt ${TIMEOUT_SECONDS} ]
then
echo "${1}:${2} to be ready after ${TIMEOUT_SECONDS}s"
echo "${1}:${2} to be ready after ${TIMEOUT_SECONDS}"
exit 1
fi
sleep 0.1
Expand Down

0 comments on commit cab1ecd

Please sign in to comment.