trafficcontrol-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/2] incubator-trafficcontrol git commit: tomcat init script fixes for traffic_router
Date Wed, 12 Jul 2017 15:54:52 GMT
Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master 5c7ecd2f1 -> 910e47448


tomcat init script fixes for traffic_router

Improving the reliabitiy of STOPPING tomcat service.

1. Add following variables to init script:
SHUTDOWN_TIMEOUT (default 10 seconds)
SHUTDOWN_FORCE (default "true" - kill if the shutdown times out)

2. Only export $CATALINA_OPTS when needed (to start the server)
Tomcat control scripts do this fun thing where to stop the current
jvm, catalina *starts* a second jvm, which then tells the first
to stop. This is all well and good, except we really don't want
to start this second jvm with our custom $CATALINA_OPTS, especially
on servers under memory pressure!


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/43c106a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/43c106a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/43c106a5

Branch: refs/heads/master
Commit: 43c106a53abce56ca18388a67725b34c589e6344
Parents: 5c7ecd2
Author: Jason Tucker <Jason_Tucker@Comcast.com>
Authored: Tue Jul 11 16:59:32 2017 -0400
Committer: Jeff Elsloo <jeffrey_elsloo@cable.comcast.com>
Committed: Wed Jul 12 09:54:18 2017 -0600

----------------------------------------------------------------------
 traffic_router/core/src/main/etc/init.d/tomcat | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/43c106a5/traffic_router/core/src/main/etc/init.d/tomcat
----------------------------------------------------------------------
diff --git a/traffic_router/core/src/main/etc/init.d/tomcat b/traffic_router/core/src/main/etc/init.d/tomcat
old mode 100644
new mode 100755
index caaff69..9b94737
--- a/traffic_router/core/src/main/etc/init.d/tomcat
+++ b/traffic_router/core/src/main/etc/init.d/tomcat
@@ -31,13 +31,18 @@
 
 . /etc/rc.d/init.d/functions
 
-export NAME=tomcat
-export TOMCAT_HOME=/opt/$NAME
-export CATALINA_PID=/var/run/tomcat/$NAME.pid
-export CATALINA_OPTS="-Xms512m -Xmx8192m -Dlog4j.configuration=file:///opt/traffic_router/conf/log4j.properties"
-export TOMCAT_LOCK=/var/lock/subsys/$NAME
+NAME=tomcat
+TOMCAT_HOME=/opt/$NAME
+CATALINA_PID=/var/run/tomcat/$NAME.pid
+TOMCAT_LOCK=/var/lock/subsys/$NAME
+CATALINA_OPTS="-Xms512m -Xmx8192m -Dlog4j.configuration=file:///opt/traffic_router/conf/log4j.properties"
+SHUTDOWN_TIMEOUT=10
+SHUTDOWN_FORCE=true
+
+export NAME TOMCAT_HOME CATALINA_PID TOMCAT_LOCK
 
 start() {
+    export CATALINA_OPTS
     runuser -s /bin/bash root -c "$TOMCAT_HOME/bin/startup.sh"
 	RETVAL=$?
 	echo -n "Starting $NAME"
@@ -52,7 +57,9 @@ start() {
 
 
 stop() {
-	$TOMCAT_HOME/bin/shutdown.sh
+	SHUTDOWN_OPTS="$SHUTDOWN_TIMEOUT"
+	[[ $SHUTDOWN_FORCE == "true" ]] && SHUTDOWN_OPTS="$SHUTDOWN_TIMEOUT -force"
+	$TOMCAT_HOME/bin/shutdown.sh $SHUTDOWN_OPTS
 	RETVAL=$?
 	echo -n "Stopping $NAME"
 	if [ $RETVAL = 0 ]; then
@@ -80,6 +87,7 @@ case "$1" in
 		fi 
 		;; 
 	force-stop)
+		# this is useless on el7, and of dubious usefulness on el6
 		stop
 		;; 
 	restart)


Mime
View raw message