[net/openntpd] pidfile support
Christian Weisgerber
naddy at mips.inka.de
Sun Jun 1 22:00:55 UTC 2014
On 2014-05-31, Tomek Wałaszek <tmwalaszek at gmail.com> wrote:
> I was missing pid file support in OpenNTPD. I've created a patch that
> enables pidfile /var/run/ntpd.pid in OpenNTPD and now I can define in the
Well, upstream doesn't support a pid file on purpose. (General
OpenBSD policy.) The argument is that the pid file construct is
inherently unreliable and dangerous: if the daemon dies, the pid
file remains and the pid may point to some random other process.
> rc script pidfile location. With pidfile location I dont see any more this
> annoying message when restarting and stopping:
>
> [root at vps24009 ~]# /usr/local/etc/rc.d/openntpd stop
> Stopping openntpd.
> kill: 20188: No such process
> kill: 20189: No such process
Yes, this is an unfortunate race. The fix would be to match the
process name against "ntpd: [priv]", the same way OpenBSD's native
rc script does. Unfortunately, this seems to be impossible with
rc.subr(8): only the first word of the process is matched against
procname.
I could override check_process; see below. Not sure how good or
bad an idea that is.
This is a general issue that should affect other daemons ported
from OpenBSD as well, e.g. net/openbgpd.
Index: files/openntpd.in
===================================================================
--- files/openntpd.in (revision 356166)
+++ files/openntpd.in (working copy)
@@ -15,6 +15,11 @@
. /etc/rc.subr
+check_process()
+{
+ /bin/pgrep -f 'ntpd: \[priv\]'
+}
+
name=openntpd
rcvar=openntpd_enable
--
Christian "naddy" Weisgerber naddy at mips.inka.de
More information about the freebsd-ports
mailing list