I use my personal laptop at both home and work and in both cases I mount nfs shares.
I would like to automate the mounting of these shares as they are done every time I turn the laptop on.
I can't make it a normal start up command to be run, because the wireless connection takes about a half a minute to locate the network and connect.
So I wanted to write up a script that checks every 5 seconds if I'm connected to a network and what the essid of the network so i can mount the appropriate shares.
I looked at iwconfig, and ifconfig and none of them return an essid, only an actual ip address.
ifconfig return…
eth0 Link encap:Ethernet HWaddr 00:26:2d:a2:01:a8
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:16
eth1 Link encap:Ethernet HWaddr f0:7b:cb:45:36:b2
inet addr:192.168.0.48 Bcast:192.168.3.255 Mask:255.255.252.0
inet6 addr: fe80::f27b:cbff:fe45:36b2/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:30972 errors:0 dropped:0 overruns:0 frame:124824
TX packets:31414 errors:16 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25279206 (25.2 MB) TX bytes:4716009 (4.7 MB)
Interrupt:17
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:336 errors:0 dropped:0 overruns:0 frame:0
TX packets:336 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:48501 (48.5 KB) TX bytes:48501 (48.5 KB)
iwconfig returns…
lo no wireless extensions.
eth0 no wireless extensions.
eth1 IEEE 802.11 Access Point: Not-Associated
Link Quality:5 Signal level:210 Noise level:165
Rx invalid nwid:0 invalid crypt:0 invalid misc:0
vboxnet0 no wireless extensions.
iwlist didn't return anything useful…
iwlist scan
lo Interface doesn't support scanning.
eth0 Interface doesn't support scanning.
eth1 Interface doesn't support scanning.
vboxnet0 Interface doesn't support scanning.
Does anyone know an easy method to find out the essid of the Wireless network you are connected to via the linux command-line.
Update
I added the ifconfig and iwconfig information above, also I'm running Ubuntu 10.10 and it was upgraded from 10.04 which seems to have messed with the wireless somewhat. They no longer use the old Network-Manager app from gnome. I can't connect to my schools wireless network either, so there is definitely something funky with the wireless to begin with.
iwevent return…
iwevent
Waiting for Wireless Events from interfaces...
16:34:33.614296 eth1 Set ESSID:"" [13]
16:34:33.615723 eth1 Custom driver event:
16:34:33.615774 eth1 New Access Point/Cell address:Not-Associated
16:34:33.714835 eth1 Set ESSID:"" [62]
16:34:41.869636 eth1 Set Mode:Managed
16:34:41.869688 eth1 Set ESSID:"" [254]
16:34:42.815795 eth1 Custom driver event:
16:35:07.141450 eth1 Set Mode:Managed
16:35:07.141502 eth1 Set Frequency:24.12 GHz
16:35:07.141601 eth1 Set ESSID:"" [121]
16:35:08.160515 eth1 New Access Point/Cell address:00:1E:00:00:19:0E
16:35:08.252912 eth1 Registered node:00:1E:52:79:19:0E
16:35:08.252970 eth1 Custom driver event:
Best Answer
Running iwgetid you get the wireless device and the SSID of the connected network. It's part of the wireless-tools - that you appear to have already installed because iwevent is also part of it.