On Wed, Dec 02, 2015 at 10:12:56AM +0100, Martijn van Duren wrote:
> Hello ports@,
> 
> currently when nginx is issued a reload command it simply sends a dumb
> SIGHUP, but without checking if the reload is loaded correctly. Since nginx
> keeps running one might get the impression that the reload was successful.
> 
> Would it make sense to check the validity of the configuration file before
> reloading, so that we can at least catch the parsing errors?
> 
> Martijn van Duren

> Index: pkg/nginx.rc
> ===================================================================
> RCS file: /cvs/ports/www/nginx/pkg/nginx.rc,v
> retrieving revision 1.12
> diff -u -p -r1.12 nginx.rc
> --- pkg/nginx.rc      29 Jul 2015 17:21:11 -0000      1.12
> +++ pkg/nginx.rc      2 Dec 2015 09:07:38 -0000
> @@ -8,4 +8,9 @@ daemon="${TRUEPREFIX}/sbin/nginx"
>  
>  pexp="nginx: master process ${daemon}${daemon_flags:+ ${daemon_flags}}"
>  
> +rc_reload() {
> +     ${daemon} ${daemon_flags} -t || return 1
> +     pkill -HUP -xf "${pexp}"
> +}
> +

You can make it a one liner:
${daemon} ${daemon_flags} -t && pkill -HUP -xf "${pexp}"

And you'd need to bump REVISION.

-- 
Antoine

Reply via email to