[Gross] Pidfile and daemonization
naked at iki.fi
Tue Apr 15 21:07:07 EEST 2008
Eino Tuominen wrote:
> Nuutti Kotivuori wrote:
>> So, I'd like to request either pidfile creation - or the ability to
>> not-daemonize and still log to syslog.
> As I've never been a fan of pidfiles I want to know exactly what do
> you expect grossd to do with pidfiles:
> 1. should grossd check if the pidfile already exists?
> 2. should grossd remove the pidfile before exiting?
> FWIW, I always use pgrep et al, it's more reliable than pidfiles,
> which could end up being stale.
For me, a workable solution would be to not check that the pidfile
already exists - that is, just overwrite it when starting. Removing
the pidfile on exit would be nice, but not entirely necessary.
I personally think that the wrapping scripts should handle all the
"housekeeping" around pidfiles - and the daemon should just create the
pidfile if it forks itself.
But some others will most likely disagree. Many daemons do check the
pidfile first and try to determine if the process is still alive.
More information about the Gross