diff --git a/scripts/app_start.sh b/scripts/app_start.sh index c89cfb9..b8ff9d5 100644 --- a/scripts/app_start.sh +++ b/scripts/app_start.sh @@ -18,14 +18,13 @@ supervisorctl add $APP_NAME-$DEPLOYMENT_ID loop_counter=0 while true; do - SOCKET_EXISTS=`test -e "/tmp/$APP_NAME-$DEPLOYMENT_ID.sock" && echo 'yes' || echo 'no'` # check to see if the socket file that the gunicorn process that is running # the app has been created. If not, wait for a second. - if [[ $SOCKET_EXISTS == 'yes' ]]; then + if [[ -e "/tmp/$APP_NAME-${DEPLOYMENT_ID}.sock" ]]; then # Pipe an HTTP request into the netcat tool (nc) and grep the response # for the deployment ID. If it's not there, wait for a second. - running_app=`printf "GET /pong/ HTTP/1.1 \r\nHost: localhost \r\n\r\n" | nc -U /tmp/$APP_NAME-${DEPLOYMENT_ID}.sock | grep -e "$DEPLOYMENT_ID" || echo 'Bad deployment'` + running_app=`printf "GET /pong/ HTTP/1.1 \r\nHost: localhost \r\n\r\n" | nc -U /tmp/$APP_NAME-${DEPLOYMENT_ID}.sock | grep -e "$DEPLOYMENT_ID" -e 'Bad deployment*' || echo 'unknown error'` echo $running_app if [[ $running_app == $DEPLOYMENT_ID ]] ; then echo "App matching $DEPLOYMENT_ID started"