Re: Homemade laptop lojack: ping website early in boot process



On 07/07/2008, at 7:16 AM, James Gray wrote:
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).

Poor form replying to my own post...but if I'd been smarter I'd have
read the rest of the text on the man page:

"There exists for each of the above mentioned options a directory /etc/
network/if-<option>.d/ the scripts in which are run (with no
arguments) using run-parts(8) after the option itself has been
processed."

So Ubuntu *does* support the Debian-style up/down pre/post directory
structures. There are also a raft of environment variables passed to
the commands in both the "interfaces" file and /etc/network/if-
<option>.d/ scripts which may prove to be useful.

Cheers,

James

PS. I shall now go and slap myself around with a large, wet, trout
while chanting the mantra "RTFM, RTFM"


--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: How can I add trusted groups to DL-groups with dsmod or other
    ... LDAP interface, there is NO DN that points to anything in the NT domains. ... > I am not a script specialist, normaly I use cmd-scripts with command> line tools like dsmod but I think my problem needs a special script> solution. ...
    (microsoft.public.windows.server.active_directory)
  • Re: Easiest/quickest method for very simple interfaces?
    ... > Michael speaks truth here wrt vim. ... >> thought on handling the interface. ... fool-proof switches instead of a single command line interface. ... I meant offering choices ...
    (comp.os.linux.misc)
  • Re: The Linux Revolution: What Happened?
    ... >> with a good graphic interface. ... even the text command is an ... And these simple commands can be made even more accessible through a GUI, ... > image from camera", but I didn't see the point at all, it was much ...
    (comp.os.linux.misc)
  • Re: The Linux Revolution: What Happened?
    ... >> with a good graphic interface. ... even the text command is an ... And these simple commands can be made even more accessible through a GUI, ... > image from camera", but I didn't see the point at all, it was much ...
    (alt.os.linux)
  • Re: The Linux Revolution: What Happened?
    ... > with a good graphic interface. ... even the text command is an ... from camera; start image viewer" or "copy images from camera to disk; ... photoshop, asks fotoshop to resize the photo, and sends it. ...
    (alt.os.linux)