Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # chmod +x flushwifi.sh
- # run as root or sudo: ./flushwifi.sh
- # AUTHOR: vvn <vvn [at] notworth.it>
- # DESCRIPTION: bash script that briefly disables WiFi interfaces and clears the routing tables.
- if (( $(id -u) )) ; then
- echo "this script needs to run as root or sudo"
- exit 1
- fi
- echo "refreshing wifi services.."
- WIFINT=`ifconfig -l | grep -oh en[1-9]`
- for i in $WIFINT
- do
- ifconfig $i down
- echo "interface $i temporarily disabled"
- sleep 2
- route -n flush
- echo "routes flushed"
- sleep 2
- ifconfig $i up
- sleep 1
- done
- echo "Wi-Fi successfully restarted."
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement