Forum: NGINX Subtle differences of restart

2974d09ac2541e892966b762aad84943?d=identicon&s=25 kalpesh.patel@glgroup.com (Guest)
on 2013-03-11 21:55
(Received via mailing list)
Hello all:

I had a few subtle question on NGINX operation and in particular are of
reseading configuration :

-- Assuming NGINX processes are running and the configuration is
syntacaly
valid, what it the difference when '.../nginx -s reload' is executed
versus
'kill -HUP <pid of master process>' is executed? Is ther any difference
in
the end result and if so what are they?

-- Assuming NGINX processes are NOT running and the configuration is
syntacaly valid, what will '.../nginx -s reload' will do?

-- Assuming NGINX processes are running and the configuration is
syntacaly
valid, what should be used to reread the configuraton from a cron job?

Thanks so answers...

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,237241,237241#msg-237241
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2013-03-12 11:14
(Received via mailing list)
Hello!

On Mon, Mar 11, 2013 at 04:54:55PM -0400, kalpesh.patel@glgroup.com
wrote:

> Hello all:
>
> I had a few subtle question on NGINX operation and in particular are of
> reseading configuration :
>
> -- Assuming NGINX processes are running and the configuration is syntacaly
> valid, what it the difference when '.../nginx -s reload' is executed versus
> 'kill -HUP <pid of master process>' is executed? Is ther any difference in
> the end result and if so what are they?

The "nginx -s reload" requires (otherwise unneeded) parsing of the
configuration file.  Otherwise it's just a tricky way to do "kill -HUP
...".
It was introduced mostly for win32 where there is no kill.

> -- Assuming NGINX processes are NOT running and the configuration is
> syntacaly valid, what will '.../nginx -s reload' will do?

It will fail as it won't be able to open pid file.

> -- Assuming NGINX processes are running and the configuration is syntacaly
> valid, what should be used to reread the configuraton from a cron job?

I would recommend using kill.

(Well, actually I wouldn't recommend reloading configuration by
cron, at least without some precautions to prevent situation when
there are too many worker processes shutting down.  But I assume
you understand what you are doing.)

--
Maxim Dounin
http://nginx.org/en/donation.html
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.