Merge branch 'stable-3.6' into stable-3.7

* stable-3.6:
  Make extra stop timeout configurable

Release-Notes: skip
Change-Id: Id18bd60589c04bf3b1924a6f8efdc3453aa1a50c
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 72519da..6a25259 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -1937,6 +1937,13 @@
 to run a new Gerrit daemon successfully.  If not set, defaults to
 90 seconds.
 
+[[container.shutdownTimeout]]container.shutdownTimeout::
++
+The maximum time (in seconds) to wait for a gerrit.sh stop command.
+This is added to the highest value between either 'sshd.gracefulStopTimeout'
+or 'httpd.gracefulStopTimeout'. If not set, defaults to
+30 seconds
+
 [[container.user]]container.user::
 +
 Login name (or UID) of the operating system user the Gerrit JVM
diff --git a/resources/com/google/gerrit/pgm/init/gerrit.sh b/resources/com/google/gerrit/pgm/init/gerrit.sh
index 1399b15..b1f6ade 100755
--- a/resources/com/google/gerrit/pgm/init/gerrit.sh
+++ b/resources/com/google/gerrit/pgm/init/gerrit.sh
@@ -388,7 +388,7 @@
 #####################################################
 # Configure the maximum wait time for shutdown
 #####################################################
-EXTRA_STOP_TIMEOUT=30
+EXTRA_STOP_TIMEOUT=$(get_time_unit_sec "$(get_config --get container.shutdownTimeout || echo 30)")
 HTTPD_STOP_TIMEOUT=$(get_time_unit_sec "$(get_config --get httpd.gracefulStopTimeout || echo 0)")
 SSHD_STOP_TIMEOUT=$(get_time_unit_sec "$(get_config --get sshd.gracefulStopTimeout || echo 0)")