Skip to content

Commit

Permalink
Pinging 1.1.1.1 and 8.8.8.8 as failover, for robustness (#12)
Browse files Browse the repository at this point in the history
Suppressing the output of the periodic ping to avoid writing too much log data to /var/log/journal
  • Loading branch information
enricodetoma authored Aug 31, 2024
1 parent 6ddf22c commit 184de36
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions wwan_keep_alive.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def connect_data():
if not system_and_sleep("timeout 20 udhcpc -i wwan0"):
continue
sleep(10)
if not system_and_sleep("ping 8.8.8.8 -I wwan0 -c1 -W2"):
if not system_and_sleep("ping 8.8.8.8 -I wwan0 -c1 -W2") and not system_and_sleep("ping 1.1.1.1 -I wwan0 -c1 -W2"):
continue
logging.info("Connected Data!")
break
Expand Down Expand Up @@ -104,7 +104,7 @@ def handle_data():
count = 0
while count < 10:
sleep(1)
if system("ping -c 1 -I wwan0 1.1.1.1"):
if system("ping -c 1 -I wwan0 1.1.1.1 > /dev/null 2>&1") or system("ping -c 1 -I wwan0 8.8.8.8 > /dev/null 2>&1"):
count = 0
else:
count += 1
Expand Down

0 comments on commit 184de36

Please sign in to comment.