Page 1 of 1

[SCRIPT] Reset Wifi

Posted: 15 Feb 2011, 15:31
by Ahau
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

#!/bin/bash
# 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.