Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Patch to /etc/init.d/ntpd to set tickadj if required
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Veto
Tux's lil' helper
Tux's lil' helper


Joined: 04 Jul 2003
Posts: 83

PostPosted: Sun Jul 06, 2003 10:31 pm    Post subject: Patch to /etc/init.d/ntpd to set tickadj if required Reply with quote

Some machines do not hold time well with the default tickadj. If you have adjusted your tickadj to make ntpd work reasonably well (~100ppm) then you might find this useful to automatically save and restore your tickadj values at boot or service start/stop/restart.

It looks for a /etc/ntp/tickadj.conf and if it exists it sets tick to the value held there. On stop it stores the current tick value to this value.

Code:

--- ntpd        2003-07-01 12:19:46.000000000 -0500
+++ /shared/ntpd-tickadj        2003-07-06 17:26:12.000000000 -0500
@@ -20,6 +20,10 @@
 start() {
        checkconfig || return $?

+       if [ -f /etc/ntp/tickadj.conf ] ; then
+               /usr/bin/tickadj `cat /etc/ntp/tickadj.conf`
+       fi
+
        if [ -n "${NTPDATE_CMD}" ] ; then
                ebegin "Initializing clock via ${NTPDATE_CMD}"
                ${NTPDATE_CMD} ${NTPDATE_OPTS} > /dev/null
@@ -35,6 +39,7 @@
 }

 stop() {
+       /usr/bin/tickadj | sed -e "s/tick\ =\ //g" >/etc/ntp/tickadj.conf
        ebegin "Stopping ntpd"
        start-stop-daemon --stop --quiet --pidfile /var/run/ntpd.pid
        eend $? "Failed to stop ntpd"

Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum