From 350219ddd975926e6403067b97c91288c9e7a9f0 Mon Sep 17 00:00:00 2001 From: Warrenberberd <47696014+warrenberberd@users.noreply.github.com> Date: Sat, 19 Nov 2022 08:09:07 +0100 Subject: [PATCH] Test webui table existancy before add --- qbittorrent/iptables.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/qbittorrent/iptables.sh b/qbittorrent/iptables.sh index 6adda46..183abb8 100644 --- a/qbittorrent/iptables.sh +++ b/qbittorrent/iptables.sh @@ -61,8 +61,10 @@ fi # Default port for WEB_UI [ -z "${WEBUI_PORT}" ] && WEBUI_PORT="8080" -echo "[info] Setup route table for webui" | ts '%Y-%m-%d %H:%M:%.S' -echo "${WEBUI_PORT} webui" >> /etc/iproute2/rt_tables +if ! grep "webui" /etc/iproute2/rt_tables > /dev/null;then + echo "[info] Setup route table for webui" | ts '%Y-%m-%d %H:%M:%.S' + echo "${WEBUI_PORT} webui" >> /etc/iproute2/rt_tables +fi ip route flush table ${WEBUI_PORT} ip route add ${LAN_NETWORK} dev eth0 table ${WEBUI_PORT}