Single-instance daemons

Jeffrey Barish jeff_barish at earthlink.net
Thu Nov 13 00:30:35 EST 2008


Cameron Simpson wrote:

> Or, more simply, get root to make an empty pid file once and chown it to
> the daemon user. Then the daemon can rewrite the file as needed. You need
> to move to truncating the file instead of removing it on daemon shutdown,
> but that is trivial. And no mucking with privileges, like starting the
> daemon as root instead of directly as the daemon user, need be done.

Although the file locking that I described is happening during boot (which I
did not make clear), so I believe that the user is root already. 
Accordingly, I need to drop privileges to a user anyway.  Still, I like
your suggestion, so I'll remember it for another occasion.
-- 
Jeffrey Barish




More information about the Python-list mailing list