В Ср, 17/07/2024 в 15:05 +0300, Zurab Kvachadze пишет:
> This is the second revision of the systemd service file for NGINX.
> 
> This commit removes redundant Exec{Stop,Reload} lines that restate
> the
> systemd defaults and changes the ExecStartPre directive from "nginx -
> t"
> (testing the NGINX configuration that is done anyway by the main
> process, bug 481456) to "mkdir -p /var/tmp/nginx", making sure the
> required directory for the NGINX temp files is present. ExecStopPost
> has
> also been removed, since sleeping for 100 ms serves no purpose.
> 
> The second revision also changes the Exec* directives to use the
> plain
> file names, instead of the absolute ones, per systemd.service(5)
> guidelines:
> > It is thus safe to use just the executable name in case of
> > executables
> > located in any of the "standard" directories, and an absolute path
> > must be used in other cases.
> 
> Bug: https://bugs.gentoo.org/481456
> Signed-off-by: Zurab Kvachadze <zurabid2...@gmail.com>
> ---
>  www-servers/nginx/files/nginx-r2.service | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>  create mode 100644 www-servers/nginx/files/nginx-r2.service
> 
> diff --git a/www-servers/nginx/files/nginx-r2.service b/www-
> servers/nginx/files/nginx-r2.service
> new file mode 100644
> index 000000000000..2916aba391a2
> --- /dev/null
> +++ b/www-servers/nginx/files/nginx-r2.service
> @@ -0,0 +1,12 @@
> +[Unit]
> +Description=The NGINX HTTP and reverse proxy server
> +After=network.target remote-fs.target nss-lookup.target
> +
> +[Service]
> +Type=forking
> +PIDFile=/run/nginx.pid
> +ExecStartPre=mkdir -p /var/tmp/nginx

Please note that systemd-tmpfiles can remove the whole /var/tmp/nginx
directory if it and its contents are not touched for a long time. And
then reload of nginx might fail. So it is better to create this
directory via tmpfiles.d.

> +ExecStart=nginx
> +
> +[Install]
> +WantedBy=multi-user.target


Reply via email to