Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
tools:raspbian [2023/10/05 02:08]
darron [WiFi problems]
tools:raspbian [2023/10/05 13:15]
darron [WiFi problems]
Line 329: Line 329:
 Pi4 WiFi can both disconnect with wpa_supplicant still running or crash. Pi4 WiFi can both disconnect with wpa_supplicant still running or crash.
  
-In the former case a script can reconnect but in the latter a reboot is required.+In the former case we can reconnect but in the latter a reboot is required.
  
 <code> <code>
-#! /bin/sh+#! /bin/bash 
 + 
 +check() { 
 +        LOSS=`ping -c 3 -i 1 192.168.0.1 | awk 'match($0, /[0-9]+%/) { print substr($0, RSTART, RLENGTH) }'` 
 +
 while test 1; do while test 1; do
         sleep 30         sleep 30
-        LOSS=`ping -c 3 -i 1 192.168.0.1 | awk 'match($0, /[0-9]+%/) { print substr($0, RSTART, RLENGTH) }'`+        check
         if test "$LOSS" = "100%"; then         if test "$LOSS" = "100%"; then
                 ifdown wlan0 1>/dev/mull 2>/dev/null                 ifdown wlan0 1>/dev/mull 2>/dev/null
                 ifup   wlan0 1>/dev/null 2>/dev/null                 ifup   wlan0 1>/dev/null 2>/dev/null
 +                sleep 5
 +                check
 +                if test "$LOSS" = "100%"; then
 +                        reboot
 +                fi
         fi         fi
 done done