-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added script to check unhealthy containers
added script to check unhealthy containers
- Loading branch information
1 parent
ada7496
commit 5229727
Showing
2 changed files
with
26 additions
and
0 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,23 @@ | ||
#!/bin/bash | ||
|
||
MAX_RETRIES=5 | ||
RETRY_DELAY=10 | ||
CODER_CONTAINER="atd-coder" | ||
|
||
for attempt in $(seq 1 $MAX_RETRIES); do | ||
echo "Attempt $attempt of $MAX_RETRIES" | ||
if ! sudo docker ps | grep -q "$CODER_CONTAINER"; then | ||
echo "Coder container failed to start. Retrying..." | ||
else | ||
echo "Coder container is running." | ||
break | ||
fi | ||
sleep $RETRY_DELAY | ||
|
||
if [ $attempt -eq $MAX_RETRIES ]; then | ||
echo "Coder container failed to start after $MAX_RETRIES attempts. Pruning all containers." | ||
sudo docker container prune -f | ||
sudo bash /usr/local/bin/atdUpdate.sh | ||
break | ||
fi | ||
done |