(Q) Running a program if and only if connected

Tomasz Ciolek tmc at dreamcraft.com.au
Sun Sep 22 20:07:31 EST 2002


 have a look at package called whereami. 

 It can be used to run all manner of programs when the network
 environment chnages to a new one... 

 ;)


On Sun, Sep 22, 2002 at 11:57:15AM +0200, Michael Renzmann wrote:
> Hi.
> 
> Timothy Murphy wrote:
> >I want to run a program on my laptop when I switch on
> >if and only if it is connected to my desktop.
> >What is the best way to do this?
> 
> If your desktop has a static IP address, try the following:
> 
> ping -c <desktop-ip> > /dev/null && echo "i'm connected to the desktop" 
> || echo "desktop is not there"
> 
> Only drawback: if the ip is not reachable the above command delays for 
> about 5 seconds.
> 
> If pinging the ip is not "secure" enough (i.e. if you are sometimes 
> connected to networks where another computer than your desktop has the 
> same ip as your desktop) you could try to work with an arpping on the 
> mac address of your desktop's network interface. arpping is part of the 
> iproute2-package.
> 
> Bye, Mike

-- 
Tomasz M. Ciolek	*
			* 	Everything falls under the law of change;	
<tmc at dreamcraft.com.au>	*	  Like a dream, a phantom, a bubble, a shadow,
<tmc at goldweb.com.au>	*	  like dew of flash of lightning.
			*	  You should contemplate like this. 
*******************************************************************************
GPG Key ID: 0x7A18E49D	*	Available on www.pgp.net
*******************************************************************************
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://lists.samba.org/archive/wireless/attachments/20020922/600ef801/attachment.bin


More information about the wireless mailing list