Script to setup WiFi at boot
So, I've got a computer I can't easily access, so I have to set it up to use WiFi at boot. Different configuration options on different Linux distributions give unpredictable results. Today I also experienced a lot of dropped connections, so I had to add a test for network connectivity and setup part of the connection when it drops.Here's the script, it is also available on https://blogologue.com/wpas.sh
#!/bin/bash
# Crontab entry: @reboot /root/wpas.sh
# Uncomment to kill any wpa_supplicant processes started automatically
#/usr/bin/killall wpa_supplicant
/sbin/wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf &> /root/wpas.log &
/bin/sleep 5
while :
do
/bin/ping -c 2 blogologue.com
if [ $? -eq 2 ]
then
/usr/bin/killall -q dhclient
/bin/sleep 5s
/sbin/dhclient wlan0
fi
/bin/sleep 5
done
[Permalink] [By morphex] [Linux (Atom feed)] [23 Jan 15:09 Europe/Oslo]