Homemade laptop lojack: ping website early in boot process

James Gray james at gray.net.au
Sun Jul 6 21:16:26 UTC 2008


On 07/07/2008, at 5:08 AM, Dotan Cohen wrote:

> I'd like to have my laptop try to ping a website that I control as
> early in the boot process as possible, preferably as soon as the wifi
> is enabled. How is this done? Thanks.

How about, as soon as the interface is up...soon enough? ;)

man interfaces
...
IFACE OPTIONS
...
        post-up _command_
               Run command after bringing the interface up.  If this
               command fails then ifup aborts, refraining from marking
               the interface as configured (even though it has really
               been configured), prints an error message, and  exits
               with status 0.  This behavior may change in the future.

The easiest way to avoid the potential "if the command fails"...you  
simply wrap the whole ping up in a script that returns zero and  
execute that script as the post-up command.  In pure Debian land,  
there is a directory "/etc/network/if-post-up.d" which will execute  
all the scripts in it when an interface comes up (not sure if Ubuntu  
support this method though as the directory doesn't exist on my  
systems).

HTH,

James




More information about the ubuntu-users mailing list