<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
-- Original post (I shouldn't have snipped it):<br>
<pre wrap="">Hello list,
In the building where I live we have a bit of a "special" Internet
access, i.e. we need to authenticate on an Internet page at a given URL.
This is a simple HTML POST. It must be done at about each boot up. I
have no idea how the network "knows" that I rebooted my computer, but
apparently it knows as if I don't re-authenticate I have no Internet
access. Anyway, that's not the point.
I'd like to have a script that authenticates me each time I (re)boot.
Writing the script is not a problem: just a curl command. However, I
wonder how to set up my system so that the script is run at every boot,
and at the correct time, e.g. the DNS service must be loaded otherwise
curl simply fails. Currently I have put the script in <i class="moz-txt-slash"><span class="moz-txt-tag">/</span>etc/profiles.d<span class="moz-txt-tag">/</span></i>,
but it often ends up being run too soon. I'd like to find some clean
solution, in line with the usual administrator best practices. The
script should be set up system wide, not for my personal use only. Maybe
that involves adding the script to init.d and set up the dependencies
right? Is there an alternative way that would be considered cleaner (or
simpler)? If that is indeed the way to go, which exactly is the
dependency? (I should be able to state that the script must be run "only
when the network is ready", but I don't know what that exactly means wrt
the available services.) Also, how to turn a simple one-line command
into an init.d script? I can copy a daemon file from an other service
and tweak it for my usage but 1) it seems unneedingly complex compared
to the fact that what I want to run is a simple command; 2) these are
daemon startup scripts, where a lot of options do not make sense for my
simple script (e.g. my script can't be "stopped" or "restarted", only
being "run").
Any reference to a tutorial on that subject or advices would be appreciated.
--
</pre>
Le 04/03/2011 19:56, Smoot Carl-Mitchell a écrit :
<blockquote cite="mid:1299264996.26252.93.camel@smoot" type="cite">
<pre wrap="">On Fri, 2011-03-04 at 19:27 +0100, Olivier Cailloux wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Le 04/03/2011 03:36, Edwards, Todd - McClatchy Interactive a écrit :
</pre>
<blockquote type="cite">
<pre wrap="">A crontab utilizing @reboot is probablly what I would use since its a simple one liner.
</pre>
</blockquote>
<pre wrap="">Thanks for your suggestion. Does not work. “Couldn't resolve host
'internet.ciup.fr'”. (Also see the other answer.)
</pre>
</blockquote>
<pre wrap="">
How is your network configured? From the above error, it sounds like
your network is not up, yet when the resolver tries to resolve the host
name.
</pre>
</blockquote>
Well I didn't configure anything special, just installed ubuntu,
never touched the network configuration. It works flawlessly once
I'm authenticated, and I can authenticate with the same script when
run manually after boot and log in. I guess it's only a timing
problem, i.e. my network is indeed not up yet (or at least the part
related to DNS resolving) when the script is run by cron but it is
if I manually run the script after having logged in.<br>
<br>
Also the script works if I set a delay of 15 seconds before running
it. But I'd like to find some clean way of configuring this, that
is, I'd like to be able to specify to run the script only when
"everything needed" (meaning, I guess: the DNS system) is ready.
That's why I thought I'd use the dependency mechanism of init.d (see
above the original post), but there may exist better approaches.<br>
Olivier<br>
<br>
</body>
</html>