best method to schedule a script a few minutes after boot?
Hi there,
I want to run a script after a small delay from reboot to reload
the firewall rules. This is because kernel timers start a bit before
zero and the timer rules are not quite right until the kernel is into
'positive time'.
I suppose I could background a 'sleep nnn' script from rc.local, but
wondering what alternatives there are?
Is this something 'at' is good for?
Other options?
Thanks,
Grant.
--
[url]http://bugsplatter.id.au[/url]
Re: best method to schedule a script a few minutes after boot?
On 2008-11-02, Grant <g_r_a_n_t_@bugsplatter.id.au> wrote:[color=blue]
> Hi there,
>
> I want to run a script after a small delay from reboot to reload
> the firewall rules. This is because kernel timers start a bit before
> zero and the timer rules are not quite right until the kernel is into
> 'positive time'.
>
> I suppose I could background a 'sleep nnn' script from rc.local, but
> wondering what alternatives there are?
>
> Is this something 'at' is good for?
>
> Other options?
>
> Thanks,
> Grant.[/color]
Any number of the scripts in rc.d use sleep to wait for some event to
complete. Why re-invent the wheel.....however, that said and FWIW, I seem
to recall that fcron has an option to run a script on bootup...I can't seem
to put my hands on the docs and haven't used it on this machine...but I seem
to recall it.....
ken
Re: best method to schedule a script a few minutes after boot?
Grant wrote:[color=blue]
> Hi there,
>
> I want to run a script after a small delay from reboot to reload
> the firewall rules. This is because kernel timers start a bit before
> zero and the timer rules are not quite right until the kernel is into
> 'positive time'.
>
> I suppose I could background a 'sleep nnn' script from rc.local, but
> wondering what alternatives there are?
>
> Is this something 'at' is good for?[/color]
For at(1), the time granularity is one minute and basically
non-determinant due to the delta between queuing and script execution.
I would add a few seconds sleep or some firewall-specific network check
at the top of the reload script, then launch from rc.local as a
background job as you mentioned.
Cheers,
Re: best method to schedule a script a few minutes after boot?
Grant wrote:[color=blue]
> Hi there,
>
> I want to run a script after a small delay from reboot to reload
> the firewall rules. This is because kernel timers start a bit before
> zero and the timer rules are not quite right until the kernel is into
> 'positive time'.
>
> I suppose I could background a 'sleep nnn' script from rc.local, but
> wondering what alternatives there are?
>
> Is this something 'at' is good for?[/color]
For at(1), the time granularity is one minute and basically
non-determinant due to the delta between queuing and script execution.
I would add a few seconds sleep or some firewall-specific network check
at the top of the reload script, then launch from rc.local as a
background job as you mentioned.
Cheers,
Re: best method to schedule a script a few minutes after boot?
On Sun, 02 Nov 2008 00:52:16 -0500, No_One <no_one@no_where.com> wrote:
[color=blue]
>On 2008-11-02, Grant <g_r_a_n_t_@bugsplatter.id.au> wrote:[color=green]
>> Hi there,
>>
>> I want to run a script after a small delay from reboot to reload
>> the firewall rules. This is because kernel timers start a bit before
>> zero and the timer rules are not quite right until the kernel is into
>> 'positive time'.
>>
>> I suppose I could background a 'sleep nnn' script from rc.local, but
>> wondering what alternatives there are?
>>[/color][/color]
....[color=blue]
>Any number of the scripts in rc.d use sleep to wait for some event to
>complete. Why re-invent the wheel.....however, that said and FWIW, I seem
>to recall that fcron has an option to run a script on bootup...I can't seem
>to put my hands on the docs and haven't used it on this machine...but I seem
>to recall it.....[/color]
So I settled for:
( /usr/bin/sleep 666; /usr/local/bin/firewall ) &
Grant.
--
[url]http://bugsplatter.id.au[/url]