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.)