Skip to content

Instantly share code, notes, and snippets.

@devsli
Last active August 29, 2015 14:12
Show Gist options
  • Save devsli/a71de2a51c78828f5437 to your computer and use it in GitHub Desktop.
Save devsli/a71de2a51c78828f5437 to your computer and use it in GitHub Desktop.
OpenWRT WiFi channel checker
#!/bin/sh
CURRENT=$(uci get wireless.radio0.channel)
HOST=$(echo $SSH_CONNECTION | awk '{print $1}') # host to ping
echo "Initial channel: $CURRENT"
set_channel()
{
uci set wireless.radio0.channel=$1
uci commit
wifi
echo "Channel $1"
}
ping_test()
{
ping -q -c 30 $HOST | grep round-trip
}
for CHANNEL in $(seq 1 11)
do
set_channel $CHANNEL
ping_test
done
set_channel $CURRENT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment