Update and rename 10-test_vpn.sh to 02-test_vpn.sh

This commit is contained in:
Alexandre
2023-12-13 23:30:52 +01:00
committed by GitHub
parent 1c487adcda
commit ac62bb09b2
2 changed files with 14 additions and 11 deletions

View File

@@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# wait until vpn is up
sleep 5
# test if vpn is up
counter=0
until [ "$counter" -gt 5 ]
do
ping -c 1 1.1.1.1 &> /dev/null && break || true
((counter++))
sleep 5
done

View File

@@ -1,11 +0,0 @@
#!/usr/bin/with-contenv bashio
# shellcheck shell=bash
# if doesn't work, try UDP
if [ ! -f /data/tdp ]; then
ping -c 1 1.1.1.1 &> /dev/null || ( bashio::log.warning "Can't connect, trying with TDP" && \
touch /data/tdp && bashio::addon.restart )
else
ping -c 1 1.1.1.1 &> /dev/null || ( bashio::log.warning "Can't connect even with TDP, reverting to default" && \
rm /data/tdp && bashio::addon.restart )
fi