Is it possible to have a script run when I connect to a wireless network?

My university hijacks all HTTP(S) connections when you first connect to force you to log in with your university account. I've already written a script to take care of the log in, but I would like to have it run automatically when I connect to the network.

link|improve this question

75% accept rate
feedback

2 Answers

up vote 1 down vote accepted

I'm pretty sure the Wicd network manager can do that. You might want to check it out, I know it work on ubuntu and opesuse

link|improve this answer
feedback

Network Manager will automatically run scripts in certain directories at certain stages of network connection.

Loo in /etc/network. You'll see four directories, with self-explanatory names (given that "if" stands for "network interface"). You're looking for if-up.d. Put your script in there, name it something like 50-university-login.sh, and mark it executable.

In case you're wondering, the numbered prefixes give the scripts an order. the "default" is 50, halfway from 01 to 99.

link|improve this answer
Old answer, but this doesn't work for me (anymore). I'm trying to run a script when (wlan0) connects to a hotspot. The script parses iwconfig and works when I manually call it. I'm on Lucid and I symlinked my script into /etc/network/if-up.d/ and it's never executed. Any idea why? – Till Aug 26 '10 at 15:31
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.