From ac62bb09b216aae2b408e0203f6c591cd7fc43b8 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 13 Dec 2023 23:30:52 +0100 Subject: [PATCH] Update and rename 10-test_vpn.sh to 02-test_vpn.sh --- qbittorrent/rootfs/etc/cont-init.d/02-test_vpn.sh | 14 ++++++++++++++ qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh | 11 ----------- 2 files changed, 14 insertions(+), 11 deletions(-) create mode 100755 qbittorrent/rootfs/etc/cont-init.d/02-test_vpn.sh delete mode 100755 qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh diff --git a/qbittorrent/rootfs/etc/cont-init.d/02-test_vpn.sh b/qbittorrent/rootfs/etc/cont-init.d/02-test_vpn.sh new file mode 100755 index 00000000000..03589d74ca8 --- /dev/null +++ b/qbittorrent/rootfs/etc/cont-init.d/02-test_vpn.sh @@ -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 diff --git a/qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh b/qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh deleted file mode 100755 index d2f695f9683..00000000000 --- a/qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh +++ /dev/null @@ -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