conf: do not check, write and delete PID file if set to '/'
If the pid file path is specified as '/', skip handling it, as it is not only unnecessary but complicates managing the service. A systemd unit can manage the program without any need for this functionality, and it makes process tracking simpler and more robust. The implementation matches the bindcmdaddress directive.
This commit is contained in:
parent
e30f937f6a
commit
1ab5b88939
2 changed files with 18 additions and 1 deletions
17
conf.c
17
conf.c
|
@ -78,6 +78,7 @@ static void parse_makestep(char *);
|
|||
static void parse_maxchange(char *);
|
||||
static void parse_ntsserver(char *, ARR_Instance files);
|
||||
static void parse_ntstrustedcerts(char *);
|
||||
static void parse_pidfile(char *line);
|
||||
static void parse_ratelimit(char *line, int *enabled, int *interval,
|
||||
int *burst, int *leak, int *kod);
|
||||
static void parse_refclock(char *);
|
||||
|
@ -703,7 +704,7 @@ CNF_ParseLine(const char *filename, int number, char *line)
|
|||
} else if (!strcasecmp(command, "peer")) {
|
||||
parse_source(p, command, 1);
|
||||
} else if (!strcasecmp(command, "pidfile")) {
|
||||
parse_string(p, &pidfile);
|
||||
parse_pidfile(p);
|
||||
} else if (!strcasecmp(command, "pool")) {
|
||||
parse_source(p, command, 1);
|
||||
} else if (!strcasecmp(command, "port")) {
|
||||
|
@ -1529,6 +1530,20 @@ parse_hwtimestamp(char *line)
|
|||
|
||||
/* ================================================== */
|
||||
|
||||
static void
|
||||
parse_pidfile(char *line)
|
||||
{
|
||||
parse_string(line, &pidfile);
|
||||
|
||||
/* / disables the PID file handling */
|
||||
if (strcmp(pidfile, "/") == 0) {
|
||||
Free(pidfile);
|
||||
pidfile = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static const char *
|
||||
get_basename(const char *path)
|
||||
{
|
||||
|
|
|
@ -2781,6 +2781,8 @@ e.g.:
|
|||
----
|
||||
pidfile /run/chronyd.pid
|
||||
----
|
||||
+
|
||||
Setting this directive to _/_ disables writing and checking of the PID file.
|
||||
|
||||
[[ptpport]]*ptpport* _port_::
|
||||
The *ptpport* directive enables *chronyd* to send and receive NTP messages
|
||||
|
|
Loading…
Reference in a new issue