# Subtle differences of restart

**URL:** <https://www.ruby-forum.com/t/subtle-differences-of-restart/227334>\
**Category:** NGINX\
**Created:** [March 11, 2013, 9:55pm UTC](https://www.ruby-forum.com/t/subtle-differences-of-restart/227334 "2013-03-11T21:55:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 11, 2013, 9:55pm UTC](https://www.ruby-forum.com/t/subtle-differences-of-restart/227334/1 "2013-03-11T21:55:42Z")

</div>

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 ’ 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:

> **[Subtle differences of restart](https://forum.nginx.org/read.php?2,237241,237241#msg-237241)**
>
> 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...

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 12, 2013, 11:14am UTC](https://www.ruby-forum.com/t/subtle-differences-of-restart/227334/2 "2013-03-12T11:14:07Z")

</div>

Hello!

On Mon, Mar 11, 2013 at 04:54:55PM -0400, [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
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 ’ 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 D.

> **[nginx: donation](http://nginx.org/en/donation.html)**
