From 8da02313109131bbe67a6353de1564b07d75a4ea Mon Sep 17 00:00:00 2001 From: mpmc Date: Sat, 22 Oct 2022 16:40:57 +0100 Subject: [PATCH] qmi-network: add a very very simple failover & adjust service settings --- qmi-network/qmi-network.conf | 2 +- systemd/system/qmi-network@.service | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/qmi-network/qmi-network.conf b/qmi-network/qmi-network.conf index f5bd75d..a3479be 100644 --- a/qmi-network/qmi-network.conf +++ b/qmi-network/qmi-network.conf @@ -1,3 +1,3 @@ # Place this file in /etc/ (as /etc/qmi-network.conf) APN=internet -PROXY=yes +#IP_TYPE=4 diff --git a/systemd/system/qmi-network@.service b/systemd/system/qmi-network@.service index 30628ed..90c267a 100755 --- a/systemd/system/qmi-network@.service +++ b/systemd/system/qmi-network@.service @@ -1,4 +1,4 @@ -# apt install --no-install-recommends libqmi-utils +# apt install --no-install-recommends libqmi-utils ifmetric # cp -v ./qmi-network@.service /etc/systemd/system/ # systemctl daemon-reload # systemctl enable --now qmi-network@0 @@ -15,7 +15,8 @@ Requires=sys-subsystem-net-devices-wwan%i.device [Service] Type=simple Restart=always -TimeoutSec=300s +RestartSec=60s +TimeoutSec=90s # Make sure the state is cleared before starting. ExecStartPre=-rm /tmp/qmi-network-state-cdc-wdm%i @@ -34,9 +35,8 @@ ExecStartPre=networkctl up wwan%i # give it some time to be ready before starting the connection process. ExecStartPre=-sh -e -c "sleep 5; qmi-network /dev/cdc-wdm%i start && sleep 5;" -# Small loop as the main process to watchdog the connection. -# (NOTE: DHCP must be given a little time to settle before pinging). -ExecStart=sh -e -c "while true; do ping -w 60 -I wwan%i -c 5 one.one.one.one; sleep 60; done;" +# Main loop with **very basic** failover. +ExecStart=sh -e -c "while true; do ping -w 10 -c 3 one.one.one.one || (ping -w 10 -I wwan%i -c 3 one.one.one.one && ifmetric wwan%i 128); sleep 30; done;" # Stop.. DOWN TIME! ExecStop=networkctl down wwan%i