Created
January 14, 2019 10:51
-
-
Save cuiwm/97a5b345d096cd823d2b7c03afb5b097 to your computer and use it in GitHub Desktop.
openresty.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#openresty.service for centos7 | |
# https://www.digitalocean.com/community/tutorials/how-to-use-the-openresty-web-framework-for-nginx-on-ubuntu-16-04 | |
# Stop dance for OpenResty | |
# A modification of the Nginx systemd script | |
# ======================= | |
# | |
# ExecStop sends SIGSTOP (graceful stop) to the Nginx process. | |
# If, after 5s (--retry QUIT/5) OpenResty is still running, systemd takes control | |
# and sends SIGTERM (fast shutdown) to the main process. | |
# After another 5s (TimeoutStopSec=5), and if OpenResty is alive, systemd sends | |
# SIGKILL to all the remaining processes in the process group (KillMode=mixed). | |
# | |
# Nginx signals reference doc: | |
# http://nginx.org/en/docs/control.html | |
# | |
[Unit] | |
Description=A dynamic web platform based on Nginx and LuaJIT. | |
After=network.target | |
[Service] | |
Type=forking | |
PIDFile=/usr/local/openresty/nginx/logs/nginx.pid | |
ExecStartPre=/usr/local/openresty/bin/openresty -t -q -g 'daemon on; master_process on;' | |
ExecStart=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;' | |
ExecReload=/usr/local/openresty/bin/openresty -g 'daemon on; master_process on;' -s reload | |
ExecStop=/bin/kill -s QUIT $MAINPID | |
#ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /usr/local/openresty/nginx/logs/nginx.pid | |
TimeoutStopSec=5 | |
KillMode=mixed | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment