Advertising
- Miscellany
- Monday, January 1st, 2007 at 9:17:35pm UTC
- #!/bin/bash
- # Remove the old log file and create the new one
- LOGFILE="/var/log/wifiSetup.log"
- touch $LOGFILE
- rm $LOGFILE
- touch $LOGFILE
- chmod a+r $LOGFILE
- # Set some test variables
- IS_HOME=`iwlist ath0 scan | grep langside`
- IS_MDS=`iwlist ath0 scan | grep MDS_Global`
- # Test those variables
- if [ $IS_HOME = 'ESSID:"langside"' ]; then
- echo "Logging onto the 'langside' network." > $LOGFILE
- ESSID="langside"
- ENC="homekey"
- MODE="managed"
- else
- if [ $IS_MDS = 'ESSID:"MDS_Global"' ]; then
- echo "Logging on the 'MDS_Global' network." > $LOGFILE
- ESSID="MDS_Global"
- ENC="workkey"
- MODE="managed"
- fi
- fi
- # Now run the command!
- echo "iwconfig ath0 essid $ESSID enc $ENC mode $MODE"
- iwconfig ath0 essid $ESSID enc $ENC mode $MODE && dhclient ath0 && echo "Connected successfully to '$ESSID'!" > $LOGFILE
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.