-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: update make wait-for-stack to use script
- Loading branch information
Showing
2 changed files
with
35 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Target port | ||
port=9080 | ||
# Timeout in seconds (2 minutes) | ||
timeout=120 | ||
# Start time | ||
start_time=$(date +%s) | ||
|
||
while true; do | ||
# Check current time | ||
current_time=$(date +%s) | ||
# Calculate elapsed time | ||
elapsed=$(( current_time - start_time )) | ||
|
||
# Check if timeout has been reached | ||
if [ $elapsed -ge $timeout ]; then | ||
echo "Timeout reached. Exiting." | ||
exit 1 | ||
fi | ||
|
||
# Check if port 9080 is available using netcat | ||
nc -z localhost $port | ||
if [ $? -eq 0 ]; then | ||
echo "Port $port is available." | ||
sleep 5 | ||
exit 0 | ||
else | ||
echo "Port $port is not available yet. Retrying..." | ||
fi | ||
|
||
# Wait for a short period before retrying | ||
sleep 2 | ||
done |