Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 28040

Summary: chrony contribution; patch to use config option for longterm RTC gain/loss adjustment across reboots
Product: Gentoo Linux Reporter: Rob Davies <Rob_Davies>
Component: Current packagesAssignee: Wout Mertens (RETIRED) <wmertens>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: High    
Version: 1.4   
Hardware: All   
OS: Linux   
URL: http://homepage.ntlworld.com/rob_davies/chronyd.patch
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: example config file, showing directives used by patch

Description Rob Davies 2003-09-06 04:55:31 UTC
A main feature of chrony, above xntp and an advantage, is support for periodic 
connection.  chronyd can use server history, and manage the RTC to time more 
accurately across reboots, with only periodic connection, or computer shutdown, 
by averaging the gain/loss of the RTC. 
 
This patch, aims to tune the chronyd startup options, where it makes sense, 
depending on the configuraton file options.  To /etc/{conf,init}.d/chronyd adds 
setting of -r if 'dumponexit' and -s arguments if 'rtcfile' is specified in the 
configuration.  A check is also made that /dev/rtc is a character special 
device, devfs won't create it if enhanced RTC support is not compiled into 
kernel.  It is based on a sys V init, package for chrony I maintained under 
SuSE-7.1 to 8.2. 
 
I have tried to comment clearly to aid the Gentoo end-user. 
 
Please advise if submission would be better made in different form.  I cd-ed 
/etc and used 'rcsdiff -r1.1 -u' to generate the patch file.  I have tested 
this with 1.19.99.2 and 1.19 under Gentoo, and used the '-s -r' options with 
chrony since version 1.15 or so under other distro's. 
 
--- conf.d/chronyd	2003/09/02 12:02:40	1.1 
+++ conf.d/chronyd	2003/09/06 11:17:11 
@@ -1,5 +1,21 @@ 
 # Copyright 1999-2003 Gentoo Technologies, Inc. 
 # Distributed under the terms of the GNU General Public License v2 
-# $Header: /etc/conf.d/RCS/chronyd,v 1.1 2003/09/02 12:02:40 root Exp $ 
+# $Header: /etc/conf.d/RCS/chronyd,v 1.3 2003/09/06 11:16:32 rob Exp $ 
 
 CFGFILE=/etc/chrony/chrony.conf 
+ 
+# 
+# Configuration dependant options : 
+#	-s - Set system time from RTC if rtcfile directive present 
+#	-r - Reload sample histories if dumponexit directive present 
+# 
+# The combination of "-s -r" allows chronyd to perform long term averaging of 
+# the gain or loss rate across system reboots and shutdowns. 
+# 
+ARGS="" 
+# 
+# devfs creates the device for RTC if it's compiled into kernel 
+test -c /dev/rtc && { 
+	grep -q '^rtcfile' $CFGFILE && ARGS="$ARGS -s" 
+} 
+grep -q '^dumponexit$' $CFGFILE && ARGS="$ARGS -r" 
--- init.d/chronyd	2003/09/02 11:41:07	1.1 
+++ init.d/chronyd	2003/09/06 11:21:06 
@@ -1,7 +1,12 @@ 
 #!/sbin/runscript 
 # Copyright 1999-2003 Gentoo Technologies, Inc. 
 # Distributed under the terms of the GNU General Public License v2 
-# $Header: /etc/init.d/RCS/chronyd,v 1.1 2003/09/02 11:41:07 root Exp $ 
+# $Header: /etc/init.d/RCS/chronyd,v 1.2 2003/09/06 11:19:22 root Exp $ 
+ 
+ 
+# 
+# $ARGS set in /etc/conf.d/chronyd 
+# 
 
 depend() { 
 	need net 
@@ -41,7 +46,7 @@ 
 	start-stop-daemon --start --quiet \ 
 		--exec /usr/sbin/chronyd \ 
 	        --pidfile $PIDFILE \ 
-                -- -f $CFGFILE 
+                -- -f $CFGFILE $ARGS 
 	eend $? "Failed to start chronyd" 
 }
Comment 1 Rob Davies 2003-09-26 01:23:32 UTC
Created attachment 18351 [details]
example config file, showing directives used by patch
Comment 2 Wout Mertens (RETIRED) gentoo-dev 2003-11-25 17:44:19 UTC
Many thanks for this; applied.