[SCRIPT] Reset Wifi

Post tutorials, HOWTO's and other useful resources here.
Post Reply
User avatar
King of Docs
King of Docs
Posts: 1331
Joined: 28 Dec 2010, 15:18
Distribution: LXDE & Xfce 32/64-bit
Location: USA

[SCRIPT] Reset Wifi

Post#1 by Ahau » 15 Feb 2011, 15:31

Here's a script that brokenman gave me a while back, and I realized it's not up here yet.

In KDE 4.6, my wifi doesn't come back on after my laptop wakes up from sleeping (whenever I close the lid). This script is, of course, useful any time you need to reset your wifi.

Copy this and save it as /usr/bin/resetwifi:

Code: Select all

# script by brokenman

killall dhcpcd
killall wpa_supplicant
rm -r /var/run/wpa_supplicant/wlan0*
rm /etc/dhcpc/dhcpcd-wlan0.pid
wpa_supplicant -c /etc/wpa_supplicant.conf -iwlan0 -Dwext &
sleep 1
dhcpcd wlan0
make it executeable (using 'chmod +x /usr/bin/resetwifi', and you'll then be able to run 'resetwifi' from the command line. This should be with root priveleges. Sometimes I have to run it twice to get my wifi back up.

If you are running in always fresh mode, you can copy this script to your rootcopy directory, i.e. /rootcopy/usr/bin and it will be inserted to /usr/bin at startup.
Please take a look at our online documentation, here. Suggestions are welcome!

Post Reply