Posted by nephix on Fri 4 Apr 12:02
report abuse | download | new post
- #!/bin/sh
- #
- # description: This small start/stop-script will let you control
- # your wpa_supplicant application to handle its correct
- # usage.
- # @name: wpa_supplicant.sh
- # @author: Thomas Pischulski <Thomas.Pischulski@mailbox.tu-dresden.de>
- # @expanded: Alexander Hagenah <ah@primepage.de>
- # @created: 04/02/2008
- # VARIABLES
- # Edit them to match your system settings
- DEVICE="wlan0"
- CONFIG="/etc/wpa_supplicant/wpa_supplicant.conf"
- USERID=`id -u`
- ANSWER=""
- if [ $USERID != 0 ]; then
- echo "You're not root"
- exit 0
- else
- case "$1" in
- "start")
- WPAPID=`pidof wpa_supplicant`
- if [ $? -eq 0 ]; then
- echo "wpa_supplicant process still running."
- echo "Kill it? [y/n] "
- read ANSWER
- case "$ANSWER" in
- "y"|"Y")
- kill -9 $WPAPID
- ;;
- "n"|"N")
- echo "Could not start wpa_supplicant because another"
- echo "process is still running. Exiting.."
- exit 0
- ;;
- *)
- echo "Answer not allowed. Exiting.."
- exit 0
- esac
- fi
- ifconfig $DEVICE up
- wpa_supplicant -dd -B -c $CONFIG -i $DEVICE -D wext
- dhclient $DEVICE
- ;;
- "stop")
- ifconfig $DEVICE down
- killall wpa_supplicant
- ;;
- *) echo "No argument given. Usage: wlanfrz (start|stop)";
- esac
- fi
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.