This is a discussion on Synchronize system clock? within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> Hi, Is there a simple way to synchronize my system clock, say, on startup? My laptop unfortunately has a ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, Is there a simple way to synchronize my system clock, say, on startup? My laptop unfortunately has a broken battery, and everytime I disconnect the power cable, the clock freezes... only to resume activity at the next boot... which always makes me travel back in time Cheers, Niki -- Whereof one cannot speak, thereof one frequently goes ranting on and on at ball-breaking length. -- Ludwig Wittgenstein, Tractatus logico- philosophicus, first draft. |
| |||
| On Fri, 15 Dec 2006 11:59:10 +0100, Niki Kovacs wrote: > Hi, > > Is there a simple way to synchronize my system clock, say, on startup? My > laptop unfortunately has a broken battery, and everytime I disconnect the > power cable, the clock freezes... only to resume activity at the next > boot... which always makes me travel back in time > > Cheers, > > Niki put this is /etc/rc.d/rc.local : /usr/sbin/ntpdate de.pool.ntp.org /sbin/hwclock -w you can change ntp server, here is the list: http://ntp.isc.org/bin/view/Servers/WebHome -- i. |
| |||
| Thelonious Monk lived in an eleven-dimensional house. On Saturday 16 Dec 2006 15:28 Ivan Rajkovic, wrote: > On Fri, 15 Dec 2006 11:59:10 +0100, Niki Kovacs wrote: > >> Hi, >> >> Is there a simple way to synchronize my system clock, say, on >> startup? > > put this is /etc/rc.d/rc.local : > > /usr/sbin/ntpdate de.pool.ntp.org > /sbin/hwclock -w Does this set the clock? I thought it needed "-s" to set. e.g. /usr/sbin/ntpdate -s de.pool.ntp.org -- del 8-) |
| |||
| Le Sat, 16 Dec 2006 16:28:39 +0100, Ivan Rajkovic a écrit*: > put this is /etc/rc.d/rc.local : > > /usr/sbin/ntpdate de.pool.ntp.org > /sbin/hwclock -w Thanks very much! Worked like a charm! Niki -- Whereof one cannot speak, thereof one frequently goes ranting on and on at ball-breaking length. -- Ludwig Wittgenstein, Tractatus logico- philosophicus, first draft. |
| |||
| On Fri, 15 Dec 2006 11:59:10 +0100, Niki Kovacs wrote: > Hi, > > Is there a simple way to synchronize my system clock, say, on startup? My > laptop unfortunately has a broken battery, and everytime I disconnect the > power cable, the clock freezes... only to resume activity at the next > boot... which always makes me travel back in time > > Cheers, > > Niki > Some dhcpd servers send the ntp clock information. The script below does some simple parsing to get the name of the server. Make the script executable and add a section in rc.local to start rc.ntpd if it is executable. #!/bin/bash # # file: /etc/rc.d/rc.ntpd # http://www.gnu.org/licenses/gpl.txt # Douglas D. Mayne (c) 2006 # NTPDATE=$(which ntpdate) NTPD=$(which ntpd) preferred_clock() { cat /etc/ntp.conf | grep -v "^#" | grep -v 127\. \ | grep "^server " | head -1 | sed 's/^server //' } set_clock() { CLOCK=$(preferred_clock) echo Preferred Clock is $CLOCK [ ! -x $NTPDATE ] && exit 1 ping -c 1 $CLOCK || exit 1 killall ntpd sleep 4 echo "Setting the clock..." $NTPDATE -b $CLOCK sleep 2 } case "$1" in 'start') set_clock && $NTPD ;; 'stop') killall ntpd ;; 'status') ntpq -c peers ;; *) echo "usage $0 start|stop|status" esac # end rc.ntpd -- Douglas Mayne |
| |||
| On 2006-12-16, Niki Kovacs <mickey@mouse.com> wrote: >> /usr/sbin/ntpdate de.pool.ntp.org >> /sbin/hwclock -w > > Thanks very much! Worked like a charm! Now, put it in one of your crons and you'll never be more than a couple nanoseconds off time. nb |
| |||
| > Thelonious Monk lived in an eleven-dimensional house. > On Saturday 16 Dec 2006 15:28 Ivan Rajkovic, wrote: > > > On Fri, 15 Dec 2006 11:59:10 +0100, Niki Kovacs wrote: > > > >> Hi, > >> > >> Is there a simple way to synchronize my system clock, say, on > >> startup? > > > > put this is /etc/rc.d/rc.local : > > > > /usr/sbin/ntpdate de.pool.ntp.org > > /sbin/hwclock -w > > Does this set the clock? I thought it needed "-s" to set. > e.g. /usr/sbin/ntpdate -s de.pool.ntp.org > no it works fine without -s ... why there is no man/info pages ? |
| |||
| > On 2006-12-16, Niki Kovacs <mickey@mouse.com> wrote: > > >> /usr/sbin/ntpdate de.pool.ntp.org > >> /sbin/hwclock -w > > > > Thanks very much! Worked like a charm! > > Now, put it in one of your crons and you'll never be more than a > couple nanoseconds off time. > > nb hoo my god /o\ you'll never put that in cron !!! What append if, a the same millisecond, all the billion of pc go and connect to ntpd server ? Read the online doc, I ve got ressource in french if you want. It is better to run ntpd instead of using ntpudate in crontab job. |
| |||
| notbob <notbob@nothome.com> wrote in news:gdudneqZY- 1VghnYnZ2dnUVZ_qWdnZ2d@comcast.com: > On 2006-12-16, Niki Kovacs <mickey@mouse.com> wrote: > Now, put it in one of your crons and you'll never be more than a > couple nanoseconds off time. For clarity's sake, the "it" above is ntpdate. I wrote an rc.ntpd with status|start|stop|restart with logging and a logrotate configuration. I posted it for comment to the Slackware forum of http://www.linuxquestions.org. There was some feedback with suggestions. http://www.linuxquestions.org/questi...d.php?t=471465 should take you right to it (if you're interested, of course). |
| ||||
| Ivan Rajkovic <ivan@iep.physik.uni-essen.de> wrote: > On Fri, 15 Dec 2006 11:59:10 +0100, Niki Kovacs wrote: > >> Hi, >> >> Is there a simple way to synchronize my system clock, say, on startup? My >> laptop unfortunately has a broken battery, and everytime I disconnect the >> power cable, the clock freezes... only to resume activity at the next >> boot... which always makes me travel back in time >> >> Cheers, >> >> Niki > > put this is /etc/rc.d/rc.local : > > /usr/sbin/ntpdate de.pool.ntp.org > /sbin/hwclock -w > > you can change ntp server, here is the list: > http://ntp.isc.org/bin/view/Servers/WebHome We still use rdate. We include the following in rc.local: /usr/bin/rdate -s 129.6.15.29 Is there a reason to use ntpd over rdate? cordially, as always, rm |