Unix Technical Forum

Can I pause before running a startup script?

This is a discussion on Can I pause before running a startup script? within the Sun Solaris Administration forums, part of the Solaris Operating System category; --> I start the xntpd deamon from /etc/rc2.d/S74xntpd in Solaris 9. Unfortunately, /etc/rc2.d/S74xntpd calls ntpdate, to set the time at ...


Go Back   Unix Technical Forum > Unix Operating Systems > Solaris Operating System > Sun Solaris Administration

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-12-2008, 06:16 AM
Dr. David Kirkby
 
Posts: n/a
Default Can I pause before running a startup script?

I start the xntpd deamon from /etc/rc2.d/S74xntpd in Solaris 9.
Unfortunately, /etc/rc2.d/S74xntpd calls ntpdate, to set the time at
boot. The ntp servers ntpdate tries to sync to are all remote ones on
the internet, as there is no local ntp server.

The problem is, the machine does not have a permanent internet
connection, but rather a 56k dialup modem. A cron job checks every
minute if the internet connection is present, and if not dials the
modem. Hence from boot, it can take a couple of minutes for the
internet connection to be up and running.


So when the machine boots, the startup script runs, ntpdate fails to
find a server, and a couple of minutes later the internet connection
is restored. But the time has not been set with ntpdate, since that
gave up long ago. However, the xntpd daemon does run.

One way around this would be to couple of minutes pause in
/etc/rc2.d/S74xntpd, but that will make the boot process annoyingly
slow.

Is there any obvious way to boot the machine, wait a couple of minutes
before calling /etc/rc2.d/S74xntpd (or some other startup script),
such that the internet connection has had time to be restored?


--
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail davek@medphys.ucl.ac.uk
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-12-2008, 06:16 AM
Dr. David Kirkby
 
Posts: n/a
Default Re: Can I pause before running a startup script?

Greg Andrews wrote:
>
> "Dr. David Kirkby" <drkirkby@ntlworld.com> writes:
> >
> >Is there any obvious way to boot the machine, wait a couple of minutes
> >before calling /etc/rc2.d/S74xntpd (or some other startup script),
> >such that the internet connection has had time to be restored?
> >

>
> Invoke a script from /etc/inittab that invokes /etc/init.d/xntpd.
> Set the inittab entry to be invoked once, after booting is finished.
> (similar to the console ttymon entry, but only run once)
>
> -Greg
> --
> Do NOT reply via e-mail.
> Reply in the newsgroup.

Thanks Greg,
But unfortunately I'm still not sure how to do it. I've to renamed
/etc/rc2.d/S74xntpd to /etc/rc2.d/_S74xntpd. I've started to make an
entry in /etc/inittab, but are not exactly sure what to put. So far I
have this:

xntp:2nce:sleep 120 && /etc/init.d/xntpd start 2>
/var/log/xntpd_start.log

would that do the trick, or would that delay the system from doing
anything for a couple of minutes?


--
Dr. David Kirkby,
Senior Research Fellow,
Department of Medical Physics,
University College London,
11-20 Capper St, London, WC1E 6JA.
Tel: 020 7679 6408 Fax: 020 7679 6269
Internal telephone: ext 46408
e-mail davek@medphys.ucl.ac.uk
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-12-2008, 06:16 AM
Oscar del Rio
 
Posts: n/a
Default Re: Can I pause before running a startup script?

> Is there any obvious way to boot the machine, wait a couple of minutes
> before calling /etc/rc2.d/S74xntpd (or some other startup script),
> such that the internet connection has had time to be restored?


If you look at the xntpd script you will notice the ntpdate|xntpd
commands are run in the background already so it would NOT slow
down the boot process

# Wait until date is close before starting xntpd
(/usr/sbin/ntpdate $ARGS; sleep 2; /usr/lib/inet/xntpd) &

You could add your own delay such as
(sleep 300; /usr/sbin/ntpdate $ARGS; sleep 2; /usr/lib/inet/xntpd) &

but better edit a COPY of the script so that your changes
will not be overwritten by patches in the future

cp /etc/init.d/xntpd /etc/init.d/myxntpd
ln /etc/init.d/myxntpd /etc/rc2.d/S74myxntpd
mv /etc/rc2.d/S74xntpd /etc/rc2.d/_S74xntpd
vi /etc/init.d/myxntpd




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-12-2008, 06:16 AM
Greg Andrews
 
Posts: n/a
Default Re: Can I pause before running a startup script?

"Dr. David Kirkby" <drkirkby@ntlworld.com> writes:
>Greg Andrews wrote:
>>
>> Invoke a script from /etc/inittab that invokes /etc/init.d/xntpd.
>> Set the inittab entry to be invoked once, after booting is finished.
>> (similar to the console ttymon entry, but only run once)
>>

>Thanks Greg,
> But unfortunately I'm still not sure how to do it.
>


Dr. Kirkby, remember that my advice was to write a *script* that
invokes /etc/init.d/xntpd, then run the *script* out of /etc/inittab.

-Greg
--
Do NOT reply via e-mail.
Reply in the newsgroup.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:31 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com