-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
797cbc8
commit e423a7a
Showing
8 changed files
with
48 additions
and
132 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
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
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
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,27 @@ | ||
#!/bin/bash | ||
|
||
is_container_active() { | ||
local job_name=$1 | ||
local is_sleep=$2 | ||
|
||
i="0" | ||
while test $i -lt 5 | ||
do | ||
sudo CONTAINERD_NAMESPACE=nomad ctr task ls|grep -q RUNNING | ||
if [ $? -eq 0 ]; then | ||
echo "INFO: ${job_name} container is up and running" | ||
if [ "$is_sleep" = true ]; then | ||
sleep 5s | ||
fi | ||
break | ||
fi | ||
echo "INFO: ${job_name} container is down, sleep for 4 seconds." | ||
sleep 4s | ||
i=$[$i+1] | ||
done | ||
|
||
if [ $i -ge 5 ]; then | ||
echo "ERROR: ${job_name} container didn't come up. exit 1." | ||
exit 1 | ||
fi | ||
} |