]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
main: dump history by default
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 8 Mar 2017 09:45:20 +0000 (10:45 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 10 Mar 2017 15:51:03 +0000 (16:51 +0100)
Always write the measurement history on exit when the dump directory is
specified and silently ignore the dumponexit directive. There doesn't
seem to be a good use case for dumpdir and -r without dumponexit as the
history would be invalidated by adjustments of the clock that happened
between the dump command and chronyd exit.

conf.c
conf.h
doc/chrony.conf.adoc
doc/chronyc.adoc
main.c

diff --git a/conf.c b/conf.c
index 8236568f2ec35657f2a270702b9c7a0e801dff3f..d400ee07c0d3fe63a0e3304faa0c75dcfc06e6d3 100644 (file)
--- a/conf.c
+++ b/conf.c
@@ -104,7 +104,6 @@ static int do_log_tracking = 0;
 static int do_log_rtc = 0;
 static int do_log_refclocks = 0;
 static int do_log_tempcomp = 0;
-static int do_dump_on_exit = 0;
 static int log_banner = 32;
 static char *logdir;
 static char *dumpdir;
@@ -469,7 +468,7 @@ CNF_ParseLine(const char *filename, int number, char *line)
   } else if (!strcasecmp(command, "dumpdir")) {
     parse_string(p, &dumpdir);
   } else if (!strcasecmp(command, "dumponexit")) {
-    do_dump_on_exit = parse_null(p);
+    /* Silently ignored */
   } else if (!strcasecmp(command, "fallbackdrift")) {
     parse_fallbackdrift(p);
   } else if (!strcasecmp(command, "hwclockfile")) {
@@ -1552,14 +1551,6 @@ CNF_GetRtcDevice(void)
 
 /* ================================================== */
 
-int
-CNF_GetDumpOnExit(void)
-{
-  return do_dump_on_exit;
-}
-
-/* ================================================== */
-
 double
 CNF_GetMaxUpdateSkew(void)
 {
diff --git a/conf.h b/conf.h
index 7ff1dba04986c3668f7cbb7de88f0cc35aea21fc..7128e6eb6198d0bbb6394c9a08c61c76128da8ac 100644 (file)
--- a/conf.h
+++ b/conf.h
@@ -60,7 +60,6 @@ extern int CNF_GetLogRefclocks(void);
 extern int CNF_GetLogTempComp(void);
 extern char *CNF_GetKeysFile(void);
 extern char *CNF_GetRtcFile(void);
-extern int CNF_GetDumpOnExit(void);
 extern int CNF_GetManualEnabled(void);
 extern int CNF_GetCommandPort(void);
 extern int CNF_GetRtcOnUtc(void);
index 7a3bedb58e46e3ac596e718c01f45a614f926502..bc28538d32cca41b3726ff33a73e137557d46503 100644 (file)
@@ -550,11 +550,9 @@ built up since the previous slew.)
 +
 For such systems, it is possible to save the measurement history across
 restarts of *chronyd* (assuming no changes are made to the system clock
-behaviour whilst it is not running). If this capability is to be used (via the
-*dumponexit* directive in the configuration file, or the
-<<chronyc.adoc#dump,*dump*>> command in *chronyc*), the *dumpdir* directive
-should be used to define the directory where the measurement histories are
-saved.
+behaviour whilst it is not running). The *dumpdir* directive defines the
+directory where the measurement histories are saved when *chronyd* exits,
+or the <<chronyc.adoc#dump,*dump*>> command in *chronyc* is issued.
 +
 An example of the directive is:
 +
@@ -566,11 +564,6 @@ A source whose IP address is _1.2.3.4_ would have its measurement history saved
 in the file _@CHRONYRUNDIR@/1.2.3.4.dat_. History of reference clocks is saved
 to files named by their reference ID in form of _refid:XXXXXXXX.dat_.
 
-[[dumponexit]]*dumponexit*::
-If this directive is present, it indicates that *chronyd* should save the
-measurement history for each of its time sources recorded whenever the program
-exits. (See the <<dumpdir,*dumpdir*>> directive above.)
-
 [[maxsamples]]*maxsamples* _samples_::
 The *maxsamples* directive sets the default maximum number of samples that
 *chronyd* should keep for each source. This setting can be overridden for
@@ -2178,8 +2171,7 @@ is made of the RTC error at a particular RTC second, and the rate at which the
 RTC gains or loses time relative to true time.
 
 When the computer is powered down, the measurement histories for all the NTP
-servers are saved to files (if the <<dumponexit,*dumponexit*>> directive is
-specified in the configuration file), and the RTC tracking information is also
+servers are saved to files, and the RTC tracking information is also
 saved to a file (if the <<rtcfile,*rtcfile*>> directive has been specified).
 These pieces of information are also saved if the <<chronyc.adoc#dump,*dump*>>
 and <<chronyc.adoc#writertc,*writertc*>> commands respectively are issued
@@ -2232,7 +2224,6 @@ log statistics measurements tracking
 driftfile @CHRONYVARDIR@/drift
 makestep 1.0 3
 maxupdateskew 100.0
-dumponexit
 dumpdir @CHRONYVARDIR@
 rtcfile @CHRONYVARDIR@/rtc
 ----
@@ -2297,7 +2288,6 @@ clientloglimit 100000000
 leapsectz right/UTC
 driftfile @CHRONYVARDIR@/drift
 dumpdir @CHRONYRUNDIR@
-dumponexit
 ----
 
 == SEE ALSO
index 5bda55cab4ec7139a71ee3d6976d880ac8a5e15b..1e4f71706e781f8c2f1ac14a5c63a5640d94bbbc 100644 (file)
@@ -1118,17 +1118,11 @@ purged. An example of how to do this is shown below.
 
 [[dump]]*dump*::
 The *dump* command causes *chronyd* to write its current history of
-measurements for each of its sources to dump files, either for inspection or to
-support the *-r* option when *chronyd* is restarted.
-+
-The *dump* command is somewhat equivalent to the
-<<chrony.conf.adoc#dumponexit,*dumponexit*>> directive in the configuration
-file.
-+
-To use the *dump* command, you might want to configure the name of the
-directory into which the dump files will be written. This can only be
-done in the configuration file with the <<chrony.conf.adoc#dumpdir,*dumpdir*>>
-directive.
+measurements for each of its sources to dump files in the directory specified
+in the configuration file by the <<chrony.conf.adoc#dumpdir,*dumpdir*>>
+directive. Note that *chronyd* does this automatically when it exits. This
+command is mainly useful for inspection of the history whilst *chronyd* is
+running.
 
 [[rekey]]*rekey*::
 The *rekey* command causes *chronyd* to re-read the key file specified in the
diff --git a/main.c b/main.c
index 22fdd8935f2f89e7c59a6056ed5de36a8660a504..21c89be08468f2e63be22dad20eb1789125a84d8 100644 (file)
--- a/main.c
+++ b/main.c
@@ -97,7 +97,7 @@ MAI_CleanupAndExit(void)
 {
   if (!initialised) exit(exit_status);
   
-  if (CNF_GetDumpOnExit()) {
+  if (CNF_GetDumpDir()[0] != '\0') {
     SRC_DumpSources();
   }