Date: Mon, 13 Feb 2012 10:20:45 +0400 From: Andrey Zonov <andrey@zonov.org> To: Dmitry Morozovsky <marck@rinet.ru> Cc: src-committers@freebsd.org, Pawel Jakub Dawidek <pjd@freebsd.org>, Guy Helmer <ghelmer@palisadesystems.com>, svn-src-all@freebsd.org, Mikolaj Golub <trociny@freebsd.org>, svn-src-head@freebsd.org Subject: Re: svn commit: r230869 - head/usr.sbin/daemon Message-ID: <4F38ABBD.7080502@zonov.org> In-Reply-To: <alpine.BSF.2.00.1202130055190.95888@woozle.rinet.ru> References: <20120205214647.GI30033@garage.freebsd.pl> <86sjiov29o.fsf@in138.ua3> <20120206082706.GA1324@garage.freebsd.pl> <86wr7zmy8f.fsf@kopusha.home.net> <20120206221742.GA1336@garage.freebsd.pl> <86liodu3me.fsf@in138.ua3> <20120208090600.GA1308@garage.freebsd.pl> <86sjihsln4.fsf@kopusha.home.net> <4F365C10.5050607@zonov.org> <861upz6fcg.fsf@kopusha.home.net> <20120212200253.GC1355@garage.freebsd.pl> <4F38240B.5040507@zonov.org> <alpine.BSF.2.00.1202130055190.95888@woozle.rinet.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On 13.02.2012 0:56, Dmitry Morozovsky wrote: > On Mon, 13 Feb 2012, Andrey Zonov wrote: > > [snip] > >>> Please don't. Even if you can't write the pidfile, you should run the >>> service. The same as for pidfile_open() failure as documented in >>> example. Feel free to warn about problem with writing to pidfile, but >>> don't treat it as critial error. >> >> The problem is the following you cannot stop such a service with standard rc.d >> script and empty pidfile. > > As for me, unstoppable (via standard way) service is at least slightly better > than unstartable. > OK, another solution for this problem is do not automatically remove pidfile when pidfile_write() fails. I can explain this. Sometimes daemons crash and I want to restart them. I use cron for this purpose like this: */5 * * * * root /usr/local/etc/rc.d/mydaemon status > /dev/null || /usr/local/etc/rc.d/mydaemon start and if mydaemon doesn't listen any socket or pidfile_write() fails and remove pidfile (it doesn't hold lock on it, in fact) mydaemon will start. If you have other solution -- welcome. -- Andrey Zonov
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F38ABBD.7080502>