Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Jun 2014 12:06:55 +0200
From:      =?UTF-8?Q?Tomek_Wa=C5=82aszek?= <tmwalaszek@gmail.com>
To:        Christian Weisgerber <naddy@mips.inka.de>, freebsd-ports@freebsd.org
Subject:   Re: [net/openntpd] pidfile support
Message-ID:  <CAN3T69vgA53ofNGpRkWR7oPuyfgyhX8G1%2BHtvGhLCeEjSRuJTQ@mail.gmail.com>
In-Reply-To: <CAN3T69v0dkAQBXOZwgQjracPykT_xtMG6w6U%2B%2B_D1_twDtndjw@mail.gmail.com>
References:  <CAN3T69vFEGXmwWjwp69oJEOPx3cLKaDyxR379xGvnzaZ-_ExtA@mail.gmail.com> <slrnlon6qq.20b9.naddy@lorvorc.mips.inka.de> <CAN3T69v0dkAQBXOZwgQjracPykT_xtMG6w6U%2B%2B_D1_twDtndjw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2014-06-02 12:06 GMT+02:00 Tomek Wa=C5=82aszek <tmwalaszek@gmail.com>:

>
> 2014-06-01 23:30 GMT+02:00 Christian Weisgerber <naddy@mips.inka.de>:
>
> On 2014-05-31, Tomek Wa=C5=82aszek <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
>> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>> --- 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=3Dopenntpd
>>  rcvar=3Dopenntpd_enable
>>
>>
>> --
>> Christian "naddy" Weisgerber                          naddy@mips.inka.de
>> _______________________________________________
>> freebsd-ports@freebsd.org mailing list
>> http://lists.freebsd.org/mailman/listinfo/freebsd-ports
>> To unsubscribe, send any mail to "freebsd-ports-unsubscribe@freebsd.org"
>
>
> Hello,
> Yes, the fix will work but it will be not a generic solution.
> Maybe for those types of programs we should have a generic solution? For
> example add a variable leader=3D"YES", and if this variable will be set t=
hen
> the rc script will kill only the 'master' process?
> I wrote a simple patch for the rc.subr, I dont know whether this solution
> is good but anyway it works for me :P
> Patch is in the attachment :)
>
> Regards,
> Tomasz Walaszek
>



--=20
Pozdrawiam
Tomasz Wa=C5=82aszek



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN3T69vgA53ofNGpRkWR7oPuyfgyhX8G1%2BHtvGhLCeEjSRuJTQ>