On 12/02/15 10:15, Antoine Jacoutot wrote:
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.
You learn something every day. :)
Index: Makefile
===================================================================
RCS file: /cvs/ports/www/nginx/Makefile,v
retrieving revision 1.86
diff -u -p -r1.86 Makefile
--- Makefile 20 Nov 2015 19:49:45 -0000 1.86
+++ Makefile 2 Dec 2015 09:36:03 -0000
@@ -5,6 +5,7 @@ BROKEN-hppa= src/core/ngx_rwlock.c:116:2
COMMENT= robust and small HTTP server and mail proxy server
VERSION= 1.9.7
+REVISION= 0
DISTNAME= nginx-${VERSION}
CATEGORIES= www
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:36:03 -0000
@@ -8,4 +8,8 @@ daemon="${TRUEPREFIX}/sbin/nginx"
pexp="nginx: master process ${daemon}${daemon_flags:+ ${daemon_flags}}"
+rc_reload() {
+ ${daemon} ${daemon_flags} -t && pkill -HUP -xf "${pexp}"
+}
+
rc_cmd $1