I’m using a rum
device in Host AP mode, so every time I try to send a large file or open many connections, the wireless link breaks down (gets “no carrier” instead of “associated”). To get it back up, I have to pull the interface on the station computer (wpi
) down and then back up.
To automate the process, I’ve written this simple script. To be run with root/operator permissions.
#!/bin/sh
# Stop wpi from falling off.
if=wpi0 # interface name
while true
do
# see if it has "no carrier" status, by looking for "no"
status=`ifconfig $if | grep status | cut -d ":" -f 2 | cut -d " " -f 2`
# bourne shell string comparison... you can has it
if [ "$status" = "no" ] ; then
ifconfig $if down
ifconfig $if up
# echo down
else
# echo up
fi
sleep 1
done