qmi-network: add a very very simple failover & adjust service settings
This commit is contained in:
parent
71c2693d11
commit
8da0231310
|
@ -1,3 +1,3 @@
|
|||
# Place this file in /etc/ (as /etc/qmi-network.conf)
|
||||
APN=internet
|
||||
PROXY=yes
|
||||
#IP_TYPE=4
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue