use docker inspect instead of docker ps grep pattern. closes #1281
This commit is contained in:
1 parent
0424d5a744
commit
633c595311
2 files changed
+10
-6
No files matched your search
@@ -95,7 +95,8 @@ if [[ ! -s "${TMPDIR}/CHECKS" ]] || [[ "$DOKKU_APP_CONTAINER_TYPE" != "web" ]];
|
|||||||
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..."
|
dokku_log_info1 "Waiting for $DOKKU_DEFAULT_WAIT seconds ..."
|
||||||
sleep $DOKKU_DEFAULT_WAIT
|
sleep $DOKKU_DEFAULT_WAIT
|
||||||
|
|
||||||
docker top "$DOKKU_APP_CONTAINER_ID" &>/dev/null || dokku_log_fail "App container failed to start!!"
|
DOKKU_APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$DOKKU_APP_CONTAINER_ID" || true)
|
||||||
|
[[ "$DOKKU_APP_CONTAINER_STATUS" != "true" ]] && dokku_log_fail "App container failed to start!!"
|
||||||
dokku_log_info1 "Default container check successful!" && exit 0
|
dokku_log_info1 "Default container check successful!" && exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -23,7 +23,8 @@ case "$1" in
|
|||||||
APP="$2"; CONTAINER_IDS=( $(get_container_ids $APP) )
|
APP="$2"; CONTAINER_IDS=( $(get_container_ids $APP) )
|
||||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||||
|
|
||||||
if [[ "$(docker ps -q --no-trunc| grep -q ${CONTAINER_IDS[0]}; echo $?)" != "0" ]]; then
|
DOKKU_APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "${CONTAINER_IDS[0]}" || true)
|
||||||
|
if [[ "$DOKKU_APP_CONTAINER_STATUS" != "true" ]]; then
|
||||||
release_and_deploy $APP
|
release_and_deploy $APP
|
||||||
else
|
else
|
||||||
echo "App $APP already running"
|
echo "App $APP already running"
|
||||||
@@ -37,12 +38,14 @@ case "$1" in
|
|||||||
APP="$2"; CONTAINER_IDS=$(get_container_ids $APP)
|
APP="$2"; CONTAINER_IDS=$(get_container_ids $APP)
|
||||||
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
! (is_deployed $APP) && echo "App $APP has not been deployed" && exit 0
|
||||||
|
|
||||||
CONTAINER_IDS_EGREP_PATTERN=$(echo $CONTAINER_IDS | xargs | sed -e "s: :|:g")
|
|
||||||
if [[ "$(docker ps -q --no-trunc| egrep -q $CONTAINER_IDS_EGREP_PATTERN; echo $?)" = "0" ]]; then
|
|
||||||
echo "Stopping $APP ..."
|
|
||||||
for CID in $CONTAINER_IDS;do
|
for CID in $CONTAINER_IDS;do
|
||||||
docker stop $CID > /dev/null
|
DOKKU_APP_CONTAINER_STATUS=$(docker inspect -f '{{.State.Running}}' "$CID" || true)
|
||||||
|
[[ "$DOKKU_APP_CONTAINER_STATUS" == "true" ]] && DOKKU_APP_RUNNING_CONTAINER_IDS+="$CID "
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ -n "$DOKKU_APP_RUNNING_CONTAINER_IDS" ]]; then
|
||||||
|
echo "Stopping $APP ..."
|
||||||
|
docker stop $DOKKU_APP_RUNNING_CONTAINER_IDS > /dev/null || true
|
||||||
else
|
else
|
||||||
echo "App $APP already stopped"
|
echo "App $APP already stopped"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user