@item -u <user>
When this option is used, chronyd will drop root privileges to the specified
user. So far, it works only on Linux when compiled with capabilities support.
+@item -q
+When run in this mode, @code{chronyd} will set the system clock once
+and exit. It will not detach from the terminal.
+@item -Q
+This option is similar to `-q', but it will only print the offset and
+not correct the clock.
@item -v
This option displays @code{chronyd's} version number to the terminal and
exits.
When this option is used, chronyd will drop root privileges to the specified
user. So far, it works only on Linux when compiled with capabilities support.
.TP
+.B \-q
+When run in this mode, chronyd will set the system clock once
+and exit. It will not detach from the terminal.
+.TP
+.B \-Q
+This option is similar to \fB\-q\fR, but it will only print the offset and
+not correct the clock.
+.TP
.B \-v
This option displays \fBchronyd\fR's version number to the terminal and exits
.TP
RTC_StartMeasurements();
RCL_StartRefclocks();
+
+ /* Special modes can end only when sources update their reachability.
+ Give up immediatelly if there are no sources. */
+ if (ref_mode != REF_ModeNormal && !SRC_ReadNumberOfSources()) {
+ REF_SetUnsynchronised();
+ }
}
/* ================================================== */
{
switch (ref_mode) {
case REF_ModeNormal:
+ case REF_ModeUpdateOnce:
+ case REF_ModePrintOnce:
exit_status = !result;
SCH_QuitProgram();
break;
debug++;
nofork = 1;
system_log = 0;
+ } else if (!strcmp("-q", *argv)) {
+ ref_mode = REF_ModeUpdateOnce;
+ nofork = 1;
+ system_log = 0;
+ } else if (!strcmp("-Q", *argv)) {
+ ref_mode = REF_ModePrintOnce;
+ nofork = 1;
+ system_log = 0;
} else if (!strcmp("-4", *argv)) {
address_family = IPADDR_INET4;
} else if (!strcmp("-6", *argv)) {
/* From now on, it is safe to do finalisation on exit */
initialised = 1;
- if (CNF_GetInitSources() > 0) {
+ if (ref_mode == REF_ModeNormal && CNF_GetInitSources() > 0) {
ref_mode = REF_ModeInitStepSlew;
}