From bf37c75b92b970f0b67efa47a436986a0c1920cd Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Mon, 11 Dec 2023 17:59:41 +0100 Subject: [PATCH] Create 10-test_vpn.sh --- qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh diff --git a/qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh b/qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh new file mode 100644 index 000000000..d2f695f96 --- /dev/null +++ b/qbittorrent/rootfs/etc/cont-init.d/10-test_vpn.sh @@ -0,0 +1,11 @@ +#!/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