Skip to content
This repository has been archived by the owner on Oct 20, 2023. It is now read-only.

Commit

Permalink
Removed orphaned Consul services.
Browse files Browse the repository at this point in the history
  • Loading branch information
darron committed Sep 2, 2014
1 parent 1338266 commit 0c9a573
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/octo
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ inspect_to_get_container_name()
if echo $tag | grep -q "CONTAINER_NAME" if echo $tag | grep -q "CONTAINER_NAME"
then then
CONTAINER_NAME=$(echo $tag | cut -d '"' -f 2 | cut -d '=' -f 2-10) CONTAINER_NAME=$(echo $tag | cut -d '"' -f 2 | cut -d '=' -f 2-10)
else
CONTAINER_NAME=$(sudo docker inspect -f '{{json .Config.Image}}' $ID | cut -d '"' -f 2)
fi fi
done done
echo $CONTAINER_NAME echo $CONTAINER_NAME
Expand Down Expand Up @@ -395,6 +397,16 @@ case "$1" in
BASE=$(inspect_to_get_container_name) BASE=$(inspect_to_get_container_name)
/usr/bin/octo service:rm $BASE $PORT /usr/bin/octo service:rm $BASE $PORT
done done
# Remove HTTP tagged orphans from crashed containers.
for service in $(/usr/bin/octo services); do
if echo $service | grep -q 'http'
then
ID=$(echo $service | jq .ID | cut -d '"' -f 2)
PORT=$(echo $ID | grep -o [0-9]*$)
BASE=${ID%-$PORT}
/usr/bin/octo service:rm $BASE $PORT
fi
done
;; ;;


domains:set) domains:set)
Expand Down

0 comments on commit 0c9a573

Please sign in to comment.