svn commit: r230869 - head/usr.sbin/daemon

Andrey Zonov andrey at
Mon Feb 13 06:20:50 UTC 2012

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

More information about the svn-src-all mailing list