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 ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 |
| |||
| 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: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 |
| |||
| > 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 |
| ||||
| "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. |