Add include directive
This commit is contained in:
parent
598c04eea2
commit
0ecabae2c3
2 changed files with 30 additions and 0 deletions
12
chrony.texi
12
chrony.texi
|
@ -1179,6 +1179,7 @@ directives can occur in any order in the file.
|
||||||
* dumpdir directive:: Specify directory for dumping measurements
|
* dumpdir directive:: Specify directory for dumping measurements
|
||||||
* dumponexit directive:: Dump measurements when daemon exits
|
* dumponexit directive:: Dump measurements when daemon exits
|
||||||
* fallbackdrift directive:: Specify fallback drift intervals
|
* fallbackdrift directive:: Specify fallback drift intervals
|
||||||
|
* include directive:: Include a configuration file
|
||||||
* initstepslew directive:: Trim the system clock on boot-up.
|
* initstepslew directive:: Trim the system clock on boot-up.
|
||||||
* keyfile directive:: Specify location of file containing keys
|
* keyfile directive:: Specify location of file containing keys
|
||||||
* linux_hz directive:: Define a non-standard value of the kernel HZ constant
|
* linux_hz directive:: Define a non-standard value of the kernel HZ constant
|
||||||
|
@ -1601,6 +1602,17 @@ By default (or if the specified maximum or minimum is 0), no fallbacks
|
||||||
will be used and the clock frequency will stay at the last value
|
will be used and the clock frequency will stay at the last value
|
||||||
calculated before synchronisation was lost.
|
calculated before synchronisation was lost.
|
||||||
@c }}}
|
@c }}}
|
||||||
|
@c {{{ include
|
||||||
|
@node include directive
|
||||||
|
@subsection include
|
||||||
|
The @code{include} directive includes a specified configuration file.
|
||||||
|
This is useful when maintaining configuration on multiple hosts to
|
||||||
|
keep the differences in a separate file.
|
||||||
|
|
||||||
|
@example
|
||||||
|
include /etc/chrony/local.conf
|
||||||
|
@end example
|
||||||
|
@c }}}
|
||||||
@c {{{ initstepslew
|
@c {{{ initstepslew
|
||||||
@node initstepslew directive
|
@node initstepslew directive
|
||||||
@subsection initstepslew
|
@subsection initstepslew
|
||||||
|
|
18
conf.c
18
conf.c
|
@ -107,6 +107,7 @@ static void parse_linux_freq_scale(const char *);
|
||||||
static void parse_sched_priority(const char *);
|
static void parse_sched_priority(const char *);
|
||||||
static void parse_lockall(const char *);
|
static void parse_lockall(const char *);
|
||||||
static void parse_tempcomp(const char *);
|
static void parse_tempcomp(const char *);
|
||||||
|
static void parse_include(const char *);
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
/* Configuration variables */
|
/* Configuration variables */
|
||||||
|
@ -261,6 +262,7 @@ static const Command commands[] = {
|
||||||
{"tempcomp", 8, parse_tempcomp},
|
{"tempcomp", 8, parse_tempcomp},
|
||||||
{"reselectdist", 12, parse_reselectdist},
|
{"reselectdist", 12, parse_reselectdist},
|
||||||
{"stratumweight", 13, parse_stratumweight},
|
{"stratumweight", 13, parse_stratumweight},
|
||||||
|
{"include", 7, parse_include},
|
||||||
{"linux_hz", 8, parse_linux_hz},
|
{"linux_hz", 8, parse_linux_hz},
|
||||||
{"linux_freq_scale", 16, parse_linux_freq_scale},
|
{"linux_freq_scale", 16, parse_linux_freq_scale},
|
||||||
{"sched_priority", 14, parse_sched_priority},
|
{"sched_priority", 14, parse_sched_priority},
|
||||||
|
@ -313,6 +315,7 @@ CNF_ReadFile(const char *filename)
|
||||||
char line[2048];
|
char line[2048];
|
||||||
char *p;
|
char *p;
|
||||||
int i, ok;
|
int i, ok;
|
||||||
|
int prev_line_number;
|
||||||
|
|
||||||
if (filename == NULL) {
|
if (filename == NULL) {
|
||||||
filename = DEFAULT_CONF_FILE;
|
filename = DEFAULT_CONF_FILE;
|
||||||
|
@ -323,6 +326,9 @@ CNF_ReadFile(const char *filename)
|
||||||
LOG(LOGS_ERR, LOGF_Configure, "Could not open configuration file [%s]", filename);
|
LOG(LOGS_ERR, LOGF_Configure, "Could not open configuration file [%s]", filename);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
/* Save current line number in case this is an included file */
|
||||||
|
prev_line_number = line_number;
|
||||||
|
|
||||||
line_number = 0;
|
line_number = 0;
|
||||||
|
|
||||||
/* Success */
|
/* Success */
|
||||||
|
@ -357,6 +363,8 @@ CNF_ReadFile(const char *filename)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line_number = prev_line_number;
|
||||||
|
|
||||||
fclose(in);
|
fclose(in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1218,6 +1226,16 @@ parse_tempcomp(const char *line)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
parse_include(const char *line)
|
||||||
|
{
|
||||||
|
while (isspace(line[0]))
|
||||||
|
line++;
|
||||||
|
CNF_ReadFile(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parse_linux_hz(const char *line)
|
parse_linux_hz(const char *line)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue