Gunnewiek.com

Netcfg Auto Connect

This script scans to see what networks are available, then checks if any of the networks are ones you want to auto connect to. If this is the case it will connect to the approperiate netcfg profile.
I start this script in my /etc/rc.local. Pick what is best for your distribution.

#! /bin/bash
sudo ifconfig wlan0 up
sudo iwlist wlan0 scan | grep ESSID: | while read line
do
    essid="${line:7:$((${#line}-7-1))}"
    #echo $essid

    if [ "$essid" == 'WLAN' ]; then
        sudo netcfg maya
    fi
    if [ "$essid" == 'eduroam' ]; then
        sudo netcfg eduroam
    fi
    if [ "$essid" == 'D3GN_SSID0' ]; then
        sudo netcfg home
    fi
    if [ "$essid" == 'Gunnewiek' ]; then
        sudo netcfg Gunnewiek
    fi
done
Comments (0)

Leave a comment

(required)