1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-15 04:32:11 +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 fi
if [ $NETPLAN -gt 0 ]; then if [ $NETPLAN -gt 0 ]; then
echo "Netplan2" echo "Netplan2 sleep 10"
wpa_processes=$(ps -A | grep wpa_supplicant | wc -l) sleep 10
if [ $wpa_processes -eq 1 ]; then 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. # This is more of a netplan workaround should go away.
echo "Starting netplan wifi" echo "Problem - Now Starting netplan wifi"
NETPLAN=2 NETPLAN=2
else else
echo "Restarting netplan wifi" echo "Not Restarting netplan wifi sleep 20"
sleep 20
fi fi
# This one handles the changing of the country code from above # This one handles the changing of the country code from above
if [ $NETPLAN -eq 2 ]; then if [ $NETPLAN -eq 2 ]; then
/bin/systemctl restart netplan-wpa-$IFACE.service echo "Restarting netplan-wpa-$IFACE sleep 20"
sleep 2 /bin/systemctl --no-block restart netplan-wpa-$IFACE.service
sleep 20
fi fi
fi fi
sleep 10
wpa_cli -i $IFACE scan > /dev/null wpa_cli -i $IFACE scan > /dev/null
sleep 2 sleep 2
FREQ=$(wpa_cli -i $IFACE scan_results | grep "$SSID" | awk '{print $2}') FREQ=$(wpa_cli -i $IFACE scan_results | grep "$SSID" | awk '{print $2}')
@ -99,9 +103,8 @@ if [ -z "$FREQ2" ]; then
exit 0 exit 0
fi fi
# ubuntu on boot exits at this point timing - issue with wpa_cli and scanning CHAN=$((FREQ2 - 2407))
CHAN=$((FREQ2 - 2407 )) CHAN=$((CHAN / 5))
CHAN=$((CHAN / 5 ))
echo "channel is $CHAN for $SSID" echo "channel is $CHAN for $SSID"
HOSTAPD=$(grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}') HOSTAPD=$(grep channel /etc/hostapd/hostapd.conf | awk -F = '{print $2}')
echo "Hostapd set for $HOSTAPD" echo "Hostapd set for $HOSTAPD"
@ -112,5 +115,3 @@ if [ "$CHAN" -ne "$HOSTAPD" ]; then
/bin/systemctl --no-block restart hostapd /bin/systemctl --no-block restart hostapd
echo "Restarted hostapd" echo "Restarted hostapd"
fi fi
exit 0