Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have two one-liner scripts that write IP address and SSID to files in my Dropbox; I would like my Android phone to sync to Dropbox and read the IP and SSID and do stuff via Tasker if it's on the same network.

That said, I am looking for a way to execute the scripts whenever I'm connected to wifi.

Thanks very much for the help!

share|improve this question
    
possible duplicate of Execute a script after a VPN connection is started –  enzotib Sep 18 '11 at 7:26
    
@enzotib - it's not exactly a duplicate, but that answer helped me out a lot. I'm still looking for a way to run a script pre-disconnect as well - basically I'm writing files to Dropbox based on the current network status of my laptop; before wireless shuts off I want to write to Dropbox and give it enough time to sync the changes to the cloud. –  Dang Khoa Sep 18 '11 at 21:46

1 Answer 1

up vote 2 down vote accepted

I had to add the following to my /etc/network/interfaces:

auto wlan0
iface wlan0 inet dhcp

Then place a script in /etc/network/if-up.d/ and check if "$IFACE" = "wlan0".

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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