[packages/nginx] - rel 4; 1s before signaling oldbin to quit was not enough and what worse it never told user that th

arekm arekm at pld-linux.org
Thu Feb 14 11:17:14 CET 2019


commit 10f92d736edd0f3ad409a54e2e529e49bb852302
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Thu Feb 14 11:17:03 2019 +0100

    - rel 4; 1s before signaling oldbin to quit was not enough and what worse it never told user that there is a proble. Both issues are fixed now.

 nginx.init | 27 ++++++++++++++++++---------
 nginx.spec |  2 +-
 2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/nginx.spec b/nginx.spec
index a43813c..f1beea8 100644
--- a/nginx.spec
+++ b/nginx.spec
@@ -42,7 +42,7 @@ Summary(pl.UTF-8):	Serwer HTTP i odwrotne proxy o wysokiej wydajności
 # - mainline: production quality but API can change
 Name:		nginx
 Version:	1.15.8
-Release:	3
+Release:	4
 License:	BSD-like
 Group:		Networking/Daemons/HTTP
 Source0:	http://nginx.org/download/%{name}-%{version}.tar.gz
diff --git a/nginx.init b/nginx.init
index f209fc0..1d62b97 100755
--- a/nginx.init
+++ b/nginx.init
@@ -133,20 +133,29 @@ condrestart() {
 # http://nginx.org/en/docs/control.html#upgrade
 # TODO: handle revert back on failed upgrade
 upgrade() {
-	local oldbin_pidfile="${pidfile}.oldbin"
+	local oldbin_pidfile="${pidfile}.oldbin" retry
 
 	checkconfig
 	show "Upgrading $svname"
 	killproc -p $pidfile $prog -USR2
 	RETVAL=$?
-	sleep 1
-	if [ -f $oldbin_pidfile ] && [ -f $pidfile ]; then
-		show "Upgrade: stopping old process"
-		killproc -p $oldbin_pidfile $prog -QUIT
-		return 0
-	else
-		return 1
-	fi
+
+	# wait for 15s
+	retry=60
+	while [ $retry -gt 0 ]; do
+		if [ -f $oldbin_pidfile ] && [ -f $pidfile ]; then
+			show "Upgrade: stopping old process"
+			killproc -p $oldbin_pidfile $prog -QUIT
+			return 0
+		else
+			usleep 250000
+			retry=$(($retry -1))
+		fi
+	done
+
+	show "Upgrade: stopping old process"; fail
+	nls 'old process pid file was not found'
+	return 1
 }
 
 # Tell nginx to reopen logs
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nginx.git/commitdiff/10f92d736edd0f3ad409a54e2e529e49bb852302



More information about the pld-cvs-commit mailing list