Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jun 2014 21:30:02 +0000 (UTC)
From:      Christian Weisgerber <naddy@mips.inka.de>
To:        freebsd-ports@freebsd.org
Subject:   Re: [net/openntpd] pidfile support
Message-ID:  <slrnlon6qq.20b9.naddy@lorvorc.mips.inka.de>
References:  <CAN3T69vFEGXmwWjwp69oJEOPx3cLKaDyxR379xGvnzaZ-_ExtA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2014-05-31, Tomek WaƂaszek <tmwalaszek@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@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@mips.inka.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?slrnlon6qq.20b9.naddy>