Location of PID file (or executable) at runtime

Tronman nginx-forum at nginx.us
Thu Apr 8 01:51:26 MSD 2010

Manlio Perillo Wrote:
> Tronman ha scritto:
> > Hi there,
> > 
> > I'm looking for a way to find the fully
> qualified path of the "PID" file at run time. 
> What do you mean by "run time"?
> The path to the PID file is well know.
> You just need to check when the file is modified
> (as an example, using
> inotify on Linux or kqueue on FreeBSD)
> > [...]
> Regards  Manlio
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx

By runtime I simply mean when the server is running. I can specify the path to the PID file in the configuration file, but if I don't, it usually sticks it in "logs/nginx.pid". But that logs/nginx.pid could be anywhere I built the server from source (it specifies a default path when you run configure). So the file could be in /bla/bla2/bla3/logs/nginx.pid. 

What I'm trying to find is the entire path of where it sticks the PID file when you start the server. For now, I'm specifying the full path in the path file, and I can extract that using the configuration functions regularly enough, but it's a bit annoying. So I'm wondering if I can get it's path when it's not specified. Just wondering if there's a better way. I will take a look at events module too, thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,72311,72498#msg-72498

More information about the nginx mailing list