PID file ownership and group

Eric Wong normalperson at
Tue Sep 20 16:23:37 EDT 2011

Lee Hambley <leehambley at> wrote:
> > Also, nginx (where unicorn draws many design elements from) does not
> > change the permissions of the pid file, either.
> > 
> >> Of course this is somewhat academic, as one must be root to signal the
> >> process anyway, but I'll cross that particular bridge when I come to
> >> it!
> > 
> > Yeah, there's no point in knowing it unless you can send signals to it.

> Surely though, with the pid being root:root when started via upstart
> (and the restrictive u+rwx/g+rwx/o-) permissions enforced by my umask,
> it would still make sense to own the pid to `unicorn:projectname` -
> given that you can signal your own processes, then the "unicorn" user
> should be able to read the pid?

Not really, the pid file is only for the master process.  The master
always stays as the user it is started as (root in your case).  Only the
worker processes have their user:group changed and they can't signal the
master after the change.

> (Although, that said, most implementations I have seen of "monitors"
> for unicorn seem to use `ps` to get the pid, which does seem somewhat
> wasteful)

Strange, wouldn't the monitors /not/ daemonize and thus be able to use
the pid of the process they started?

> Thanks for getting back to me so quickly on here Eric, with Github I'd
> almost forgotten that mailing lists work!

No problem.  Signups/logins/passwords bother me, and I also dislike
99.999% of HTML, images, and JavaScript on the web; so I'll be sticking
to mailing lists :)

Eric Wong

More information about the mongrel-unicorn mailing list