scripts/start-ping.sh aktualisiert

This commit is contained in:
2024-10-28 08:27:43 +01:00
parent 5df8420e55
commit f00b9cb0f1

View File

@@ -1,7 +1,17 @@
#!/bin/bash #!/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 sleep 10
while true; do 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,...---" echo "---Ping from ${PING_IP} failed, restarting container,...---"
kill -SIGKILL $(pidof openvpn) kill -SIGKILL $(pidof openvpn)
fi fi