1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00

capture running code

This commit is contained in:
Jerry Vonau 2023-04-24 12:23:56 -05:00
parent 04ce0a9d7f
commit 78603de7e6

View file

@ -61,21 +61,25 @@ if [ -z "$SSID" ]; then
fi
if [ $NETPLAN -gt 0 ]; then
echo "Netplan2"
wpa_processes=$(ps -A | grep wpa_supplicant | wc -l)
if [ $wpa_processes -eq 1 ]; then
echo "Netplan2 sleep 10"
sleep 10
wifi_processes=$(ps -A | grep wpa_supplicant | wc -l)
if [ $wifi_processes -eq 1 ]; then
# This is more of a netplan workaround should go away.
echo "Starting netplan wifi"
echo "Problem - Now Starting netplan wifi"
NETPLAN=2
else
echo "Restarting netplan wifi"
echo "Not Restarting netplan wifi sleep 20"
sleep 20
fi
# This one handles the changing of the country code from above
if [ $NETPLAN -eq 2 ]; then
/bin/systemctl restart netplan-wpa-$IFACE.service
sleep 2
echo "Restarting netplan-wpa-$IFACE sleep 20"
/bin/systemctl --no-block restart netplan-wpa-$IFACE.service
sleep 20
fi
fi
sleep 10
wpa_cli -i $IFACE scan > /dev/null
sleep 2
FREQ=$(wpa_cli -i $IFACE scan_results | grep "$SSID" | awk '{print $2}')
@ -99,7 +103,6 @@ if [ -z "$FREQ2" ]; then
exit 0
fi
# ubuntu on boot exits at this point timing - issue with wpa_cli and scanning
CHAN=$((FREQ2 - 2407))
CHAN=$((CHAN / 5))
echo "channel is $CHAN for $SSID"
@ -112,5 +115,3 @@ if [ "$CHAN" -ne "$HOSTAPD" ]; then
/bin/systemctl --no-block restart hostapd
echo "Restarted hostapd"
fi
exit 0