mirror of
https://github.com/haugene/docker-transmission-openvpn.git
synced 2025-08-16 11:17:06 +02:00
21 lines
446 B
Bash
Executable File
21 lines
446 B
Bash
Executable File
#!/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}
|
|
|
|
if [[ -z "$HOST" ]]
|
|
then
|
|
echo "Host not set! Set env 'HEATH_CHECK_HOST'. For now, using default google.com"
|
|
HOST="google.com"
|
|
fi
|
|
|
|
ping -c 1 $HOST
|
|
STATUS=$?
|
|
if [[ ${STATUS} -ne 0 ]]
|
|
then
|
|
echo "Network is down"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Network is up"
|
|
exit 0 |