Permalink
Browse files

If it doesn't launch, then try and relaunch it, notify to EMAIL_NOTIF…

…ICATION.
  • Loading branch information...
darron committed May 8, 2014
1 parent 6207d7a commit d3b95255f279c4e8e4a867fd23b58bc32ca43866
Showing with 23 additions and 0 deletions.
  1. +2 −0 bin/default
  2. +21 −0 bin/receiver.sh
View
@@ -24,3 +24,5 @@ TENTACLES="docker run -d -e REDIS_URL=redis://$REDIS_SERVER -p $TENTACLES_PORT:5
# octohost servers that work as a cluster, then this should be a
# different value.
ENDPONT_ADDR="127.0.0.1"
EMAIL_NOTIFICATION="sysadmin@example.com"
View
@@ -95,6 +95,27 @@ then
then
PORT=$(sudo docker port $ID $INTERNAL_PORT | sed 's/0.0.0.0://')
fi
if [ -z "$PORT" ]
then
echo "#################################################"
echo "Something went wrong, trying again."
echo "Killing the container we just launched."
sudo docker kill $ID > /dev/null
echo "Launching a new one"
ID=$(sudo docker run $RUN_OPTIONS $BUILD_ORG_NAME/$BASE)
PORT=$(sudo docker port $ID $INTERNAL_PORT | sed 's/0.0.0.0://')
if [ -z "$PORT" ]
then
echo "docker run $RUN_OPTIONS $BUILD_ORG_NAME/$BASE" | mail -s "$BASE failed to launch on $PUBLIC_IP" $EMAIL_NOTIFICATION
else
echo "docker run $RUN_OPTIONS $BUILD_ORG_NAME/$BASE" | mail -s "$BASE launched on the second try on $PUBLIC_IP" $EMAIL_NOTIFICATION
fi
echo "#################################################"
else
echo "Everything looks good."
fi
else
echo "There is no Dockerfile present."
exit

0 comments on commit d3b9525

Please sign in to comment.