diff --git a/scripts/start-ping.sh b/scripts/start-ping.sh index fc6c43b..e7afa0c 100644 --- a/scripts/start-ping.sh +++ b/scripts/start-ping.sh @@ -1,7 +1,17 @@ #!/bin/bash +if [ -z "${PING_COUNT}" ]; then + PING_COUNT=1 +fi +if [ -z "${PING_PACKET_TIMEOUT}" ]; then + PING_PACKET_TIMEOUT=10 +fi +if [ -z "${PING_INTERVAL}" ]; then + PING_INTERVAL=30 +fi + sleep 10 while true; do - if ! ping -c 1 -W 10 ${PING_IP} >/dev/null 2>&1 ; then + if ! ping -c ${PING_COUNT} -W ${PING_PACKET_TIMEOUT} ${PING_IP} >/dev/null 2>&1 ; then echo "---Ping from ${PING_IP} failed, restarting container,...---" kill -SIGKILL $(pidof openvpn) fi