#!/bin/sh
# Written by hip0 23.09.2008
# Under GPL v2
# Read it here http://gnu.org/licenses/gpl2.txt

# kill any existing instances of wpa_supplicant or dhclient
if [[ $(ps ax |grep -i dhclient|grep -v grep) ]]; then
killall -9 dhclient >/dev/null 2>&1
fi

if [[ $(ps ax |grep -i wpa_supplicant|grep -v grep) ]]; then
killall -9 wpa_supplicant >/dev/null 2>&1
fi

# initialize connection to the HAN wireless AP
wpa_supplicant -B -i wlan0 -D wext -c /etc/wpa_supplicant.conf
sleep 5;
dhclient -nw wlan0 >/dev/null 2>&1
