October 01, 2013

Manual Wireless start/stop script

wifistart.sh


#!/usr/bin/env bash
#set -x
dhclient -r wlan0
ifconfig wlan0 0.0.0.0 down
iwconfig wlan0 essid "skynet"
ifconfig wlan0 up
wpa_supplicant -iwlan0 -c /etc/wpa_supplicant/wpa_home.conf -Dwext -dd >/dev/null 2>&1 &
sleep 5 && dhclient -H `hostname` wlan0 &

/etc/wpa_supplicant/wpa_home.conf


ctrl_interface=/var/run/wpa_home
ctrl_interface_group=wheel

#eapol_version=1
#ap_scan=1
#fast_reauth=1

network={
	ssid="skynet"
        scan_ssid=1
	key_mgmt=WPA-PSK
	proto=WPA

	pairwise=TKIP
	group=TKIP

	#psk="real wifi password"
	psk=9aab192..........
}

wifistop.sh


#!/usr/bin/env bash
#set -x
dhclient -r wlan0
sleep 3
#killall dhclient
ifconfig wlan0 0.0.0.0 down
killall wpa_supplicant