脚本:
#!/bin/sh
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
TOMCAT_USER=tomcat
JAVA_HOME=/data/java/jre
export JAVA_HOME
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/data/apache-tomcat
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m -Xmx2560m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
# Setting Appdynamics agent
# SDE 2014-01-02: Disabled until the permission problems are figured out
#JAVA_OPTS="$JAVA_OPTS -DappEnv=dev -javaagent:/data/Appdynamics_Agent/javaagent.jar"
export JAVA_OPTS
# SDE 2014-01-02: dataapi1 disabled until we can figure out how to get it running
# properly.
INSTANCES="$INSTANCES /data/tomcat-instances/a1"
INSTANCES="$INSTANCES /data/tomcat-instances/a2"
for INSTANCE in $INSTANCES; do
CATALINA_BASE=$INSTANCE
export CATALINA_BASE
case $1 in
start)
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/startup.sh"
;;
stop)
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/shutdown.sh"
;;
restart)
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/shutdown.sh"
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/startup.sh"
;;
esac
done
step:
Create /data/tomcat-instances/a1 as a new CATALINA_BASE. This can be copied from /data/apache-tomcat-7.0.37/
{conf,logs,temp,webapps,work}
• Set the file ownership and permissions on /data/tomcat-instances/dataapi1 correctly. For example, configuration files in /data/tomcat-instances/conf should be owned by tomcat:tomcat and chmod 0600. The logs directory in /data/tomcat-instances/a1/logs should be owned by tomcat:tomcat. Etc. Use /data/tomcat-instances/a2 as a template for how permissions should work.
• Stop the Tomcat 7.0.37 instance. Make sure it is never started again.
• Modify script to start up /data/tomcat-instances/a1.
• Restart tomcat (/etc/init.d/tomcat restart). Ensure that the DataAPI v1 is working correctly on server, and fix any issues that come up.
#!/bin/sh
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
TOMCAT_USER=tomcat
JAVA_HOME=/data/java/jre
export JAVA_HOME
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/data/apache-tomcat
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms1024m -Xmx2560m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:+DisableExplicitGC"
# Setting Appdynamics agent
# SDE 2014-01-02: Disabled until the permission problems are figured out
#JAVA_OPTS="$JAVA_OPTS -DappEnv=dev -javaagent:/data/Appdynamics_Agent/javaagent.jar"
export JAVA_OPTS
# SDE 2014-01-02: dataapi1 disabled until we can figure out how to get it running
# properly.
INSTANCES="$INSTANCES /data/tomcat-instances/a1"
INSTANCES="$INSTANCES /data/tomcat-instances/a2"
for INSTANCE in $INSTANCES; do
CATALINA_BASE=$INSTANCE
export CATALINA_BASE
case $1 in
start)
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/startup.sh"
;;
stop)
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/shutdown.sh"
;;
restart)
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/shutdown.sh"
su $TOMCAT_USER sh -c "$CATALINA_HOME/bin/startup.sh"
;;
esac
done
step:
Create /data/tomcat-instances/a1 as a new CATALINA_BASE. This can be copied from /data/apache-tomcat-7.0.37/
{conf,logs,temp,webapps,work}
• Set the file ownership and permissions on /data/tomcat-instances/dataapi1 correctly. For example, configuration files in /data/tomcat-instances/conf should be owned by tomcat:tomcat and chmod 0600. The logs directory in /data/tomcat-instances/a1/logs should be owned by tomcat:tomcat. Etc. Use /data/tomcat-instances/a2 as a template for how permissions should work.
• Stop the Tomcat 7.0.37 instance. Make sure it is never started again.
• Modify script to start up /data/tomcat-instances/a1.
• Restart tomcat (/etc/init.d/tomcat restart). Ensure that the DataAPI v1 is working correctly on server, and fix any issues that come up.