Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jclulow opened this issue Sep 27, 2024 · 0 comments
Open

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

jclulow opened this issue Sep 27, 2024 · 0 comments

Comments

@jclulow
Copy link
Contributor

jclulow commented Sep 27, 2024

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:

<exec_method type="method"
name="stop"
exec="%{config/exec} -s stop"
timeout_seconds="60" />
<exec_method type="method"
name="refresh"
exec="%{config/exec} -s reload"
timeout_seconds="60" />

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant