> Were you able to try applying this patch? Yes, it seems working (start/stop/restart tested) for few days.
See attached patch.
>From 37fb75461c7102617fedd9f270baaf8fe32bcbaa Mon Sep 17 00:00:00 2001 From: Sergey B Kirpichev <skirpic...@gmail.com> Date: Mon, 23 Dec 2013 19:11:30 +0400 Subject: [PATCH 1/2] Add a -p option to openntpd to create a pidfile (Closes: #726650) --- debian/openntpd.init | 2 + debian/patches/06-pid.patch | 144 +++++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 147 insertions(+) create mode 100644 debian/patches/06-pid.patch diff --git a/debian/openntpd.init b/debian/openntpd.init index 6859368..e3e29db 100644 --- a/debian/openntpd.init +++ b/debian/openntpd.init @@ -28,6 +28,8 @@ if [ -f /etc/default/openntpd ]; then . /etc/default/openntpd fi +DAEMON_OPTS="${DAEMON_OPTS:-} -p /var/run/openntpd.pid" + set -e case "$1" in diff --git a/debian/patches/06-pid.patch b/debian/patches/06-pid.patch new file mode 100644 index 0000000..6479c70 --- /dev/null +++ b/debian/patches/06-pid.patch @@ -0,0 +1,144 @@ +Description: adding a -p option to openntpd to create a pidfile +Origin: https://bugs.gentoo.org/show_bug.cgi?id=493082 +Bug-Debian: http://bugs.debian.org/726650 + +--- + ntpd.8 | 6 +++++- + ntpd.c | 39 ++++++++++++++++++++++++++++++++++----- + ntpd.h | 1 + + 3 files changed, 40 insertions(+), 6 deletions(-) + +--- a/ntpd.8 ++++ b/ntpd.8 +@@ -25,6 +25,7 @@ + .Bk -words + .Op Fl dnSsv + .Op Fl f Ar file ++.Op Fl p Ar file + .Ek + .Sh DESCRIPTION + The +@@ -63,13 +64,16 @@ + .Xr ntpd.conf 5 . + .Pp + The options are as follows: +-.Bl -tag -width "-f fileXXX" ++.Bl -tag -width "-p fileXXX" + .It Fl d + Do not daemonize. + If this option is specified, + .Nm + will run in the foreground and log to + .Em stderr . ++.It Fl p Ar file ++Write pid to ++.Ar file + .It Fl f Ar file + Use + .Ar file +--- a/ntpd.c ++++ b/ntpd.c +@@ -78,7 +78,7 @@ + { + extern char *__progname; + +- fprintf(stderr, "usage: %s [-dnSsv] [-f file]\n", __progname); ++ fprintf(stderr, "usage: %s [-dnSsv] [-f file] [-p file]\n", __progname); + exit(1); + } + +@@ -105,7 +105,7 @@ + log_init(1); /* log to stderr until daemonized */ + res_init(); /* XXX */ + +- while ((ch = getopt(argc, argv, "df:nsSv")) != -1) { ++ while ((ch = getopt(argc, argv, "df:np:sSv")) != -1) { + switch (ch) { + case 'd': + lconf.debug = 1; +@@ -116,6 +116,9 @@ + case 'n': + lconf.noaction = 1; + break; ++ case 'p': ++ lconf.pid_file = optarg; ++ break; + case 's': + lconf.settime = 1; + break; +@@ -157,9 +160,17 @@ + reset_adjtime(); + if (!lconf.settime) { + log_init(lconf.debug); +- if (!lconf.debug) ++ if (!lconf.debug) { + if (daemon(1, 0)) + fatal("daemon"); ++ else if (lconf.pid_file != NULL) { ++ FILE *f = fopen(lconf.pid_file, "w"); ++ if (f == NULL) ++ fatal("couldn't open pid file"); ++ fprintf(f, "%ld\n", (long) getpid()); ++ fclose(f); ++ } ++ } + } else + timeout = SETTIME_TIMEOUT * 1000; + +@@ -201,9 +212,17 @@ + log_init(lconf.debug); + log_debug("no reply received in time, skipping initial " + "time setting"); +- if (!lconf.debug) ++ if (!lconf.debug) { + if (daemon(1, 0)) + fatal("daemon"); ++ else if (lconf.pid_file != NULL) { ++ FILE *f = fopen(lconf.pid_file, "w"); ++ if (f == NULL) ++ fatal("couldn't open pid file"); ++ fprintf(f, "%ld\n", (long) getpid()); ++ fclose(f); ++ } ++ } + } + + if (nfds > 0 && (pfd[PFD_PIPE].revents & POLLOUT)) +@@ -242,6 +261,8 @@ + msgbuf_clear(&ibuf->w); + free(ibuf); + log_info("Terminating"); ++ if (lconf.pid_file != NULL) ++ unlink(lconf.pid_file); + return (0); + } + +@@ -316,9 +337,17 @@ + memcpy(&d, imsg.data, sizeof(d)); + ntpd_settime(d); + /* daemonize now */ +- if (!lconf->debug) ++ if (!lconf->debug) { + if (daemon(1, 0)) + fatal("daemon"); ++ else if (lconf->pid_file != NULL) { ++ FILE *f = fopen(lconf->pid_file, "w"); ++ if (f == NULL) ++ fatal("couldn't open pid file"); ++ fprintf(f, "%ld\n", (long) getpid()); ++ fclose(f); ++ } ++ } + lconf->settime = 0; + break; + case IMSG_HOST_DNS: +--- a/ntpd.h ++++ b/ntpd.h +@@ -178,6 +178,7 @@ + u_int8_t debug; + u_int32_t scale; + u_int8_t noaction; ++ char *pid_file; + }; + + struct buf { diff --git a/debian/patches/series b/debian/patches/series index 1f6454e..863a712 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -3,3 +3,4 @@ 03-manpage-no-server-by-default.patch 04-syslog.patch 05-fix-kfreebsd-ftbfs.patch +06-pid.patch -- 1.7.10.4