checking config outputs a pid file

Igor Sysoev is at
Tue May 27 09:31:21 MSD 2008

On Tue, May 27, 2008 at 11:53:45AM +0800, Cherife Li wrote:

> Hi all,
> Has anyone noticed that `nginx -t' outputs an empty pid file while the 
> nginx process isn't running.
> I can only add
>   if [ ! -s $PID ]; then
>     rm -f $PID
>   fi
> to the check-config section of my rc file at the moment.

Yes, nginx creates pid file on -t to test possibility to create it.
It does not write any pid there and does not remove it.
The later was done intentionally because there may be race condition
when nginx startes, creates file, then someone run nginx -t, it creates
file, and deletes it.

Igor Sysoev

More information about the nginx mailing list