I would like my phone to execute certain shell scripts via Tasker if my phone is on the same wifi network as my laptop. My initial idea is to edit the /etc/hosts
file, but this wouldn't work since neither device is constrained to be on only one wifi network.
A much more costly idea would be to just ping every possible address on the network from my phone, then attempt to send a command via ssh (say, echo $ANDROID
) and listen for the response.
The best way to do this is to just be able to see if a device named "myLaptop" exists on the network.. (or, actually, I could use MAC address too.) but I have no idea if this is possible in bash. Is it?
(I'm also open to implementations in Perl, since I can use SL4A to implement Perl scripts.)
Answer
Dynamic DNS service would work. Get your laptop to update your dynamic domain with it's local ip, and then whenever your phone connects to a new wifi network, resolve that domain, if you get a hit, you're either good or happened to find someone with the same local ip!
Similar to that, you could get your laptop to post it's ip to a server somewhere (web, email, w/e) that you can retrieve from a script on your phone.
Short of setting up a DNS server, I'm not sure there is any means for resolving host names that aren't named in your local configs.
No comments:
Post a Comment