omniosorg / omnios-extra

Packages for OmniOS extra
https://omnios.org
Other
27 stars 58 forks source link

nginx "stop" and "refresh" methods should use the method script #1521

Open jclulow opened 1 month ago

jclulow commented 1 month ago

In the nginx service, the start method uses the shipped method script. The stop and restart methods appear to directly execute the nginx binary itself:

https://github.com/omniosorg/omnios-extra/blob/4e1b85288a0781acbc9733118039f27cd270e232/build/nginx/files/http-nginx-template.xml#L76-L84

I think we should consistently send it all through the method script, and be sure to pass the -c option to specify the configuration file in the other cases as well as just for start.

Another, possibly preferable, option seems like it would be to redo the refresh method as a simple :kill -HUP. The stop method could be :kill, as SIGTERM is the default signal and is essentially exactly what nginx -s stop does. (To confirm this, I inspected src/os/unix/ngx_process.c to find that -s stop translates to NGX_TERMINATE_SIGNAL which is SIGTERM for UNIX.) This is documented behaviour in nginx(8), at least, not some internal interface. This would mean we weren't dependent on the pid file to locate the process, etc.