Standardize scripts, use bash and double brackets

This commit is contained in:
Kristian Haugene
2019-03-09 18:52:06 +01:00
parent 43abe72c2a
commit 66c7634f18
9 changed files with 41 additions and 42 deletions

View File

@@ -1,9 +1,9 @@
#!/bin/sh
#!/bin/bash
# Ping uses both exit codes 1 and 2. Exit code 2 cannot be used for docker health checks,
# therefore we use this script to catch error code 2
HOST=$HEALTH_CHECK_HOST
HOST=${HEALTH_CHECK_HOST}
if [ -z "$HOST" ]
if [[ -z "$HOST" ]]
then
echo "Host not set! Set env 'HEATH_CHECK_HOST'. For now, using default google.com"
HOST="google.com"
@@ -11,12 +11,11 @@ fi
ping -c 1 $HOST
STATUS=$?
if [ $STATUS -ne 0 ]
if [[ ${STATUS} -ne 0 ]]
then
echo "Network is down"
exit 1
fi
echo "Network is up"
exit 0
exit 0