Tomcat后台服务(开机启动)Shell代码,安装过程请参照上一篇

# Open files number
ulimit -n 65535
#!/bin/bash
# chkconfig: 234 78 36
# description: Starts and stops Tomcat
##############################################################################
#
#   Copyright 2004 The Apache Software Foundation.
#
#   Licensed under the Apache License, Version 2.0 (the "License");
#   you may not use this file except in compliance with the License.
#   You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#   Unless required by applicable law or agreed to in writing, software
#   distributed under the License is distributed on an "AS IS" BASIS,
#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#   See the License for the specific language governing permissions and
#   limitations under the License.
##############################################################################
#
# Small shell script to show how to start/stop Tomcat using jsvc
# If you want to have Tomcat running on port 80 please modify the server.xml
# file:
#
#    <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
#    <Connector className="org.apache.catalina.connector.http.HttpConnector"
#               port="80" minProcessors="5" maxProcessors="75"
#               enableLookups="true" redirectPort="8443"
#               acceptCount="10" debug="0" connectionTimeout="60000"/>
#
# That is for Tomcat-7.0.x (Apache Tomcat/7.0)
#
# Adapt the following lines to your configuration
JAVA_HOME=/var/tomcat/jdk1.7.0_05
CATALINA_HOME=/var/tomcat/tomcat
DAEMON_HOME=/var/tomcat/tomcat/bin/commons-daemon-1.0.10-native-src/unix
TOMCAT_USER=xz_lan
JAVA_OPTS="-Xms4096M -Xmx4096M -Xmn512M -Xss256K -XX:PermSize=256M -XX:MaxPermSize=256M -XX:-UseGCOverheadLimit -XX:SurvivorRatio=1 -Xnoclassgc -XX:+DisableExplicitGC -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+UseCMSCompactAtFullCollection -XX:CMSFullGCsBeforeCompaction=0 -XX:+CMSClassUnloadingEnabled -XX:-CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128M -XX:CMSInitiatingOccupancyFraction=85 -XX:SoftRefLRUPolicyMSPerMB=0"

# for multi instances adapt those lines.
TMP_DIR=/var/tomcat/tomcat/temp
PID_FILE=/var/tomcat/tomcat/temp/jsvc.pid
CATALINA_BASE=/var/tomcat/tomcat

CATALINA_OPTS="-Djava.library.path=/var/tomcat/tomcat/bin/tomcat-native-1.1.24-src/jni/native/.libs"
CLASSPATH=\
$JAVA_HOME/lib/tools.jar:\
$CATALINA_HOME/bin/commons-daemon.jar:\
$CATALINA_HOME/bin/tomcat-juli.jar:\
$CATALINA_HOME/bin/bootstrap.jar

case "$1" in
  start)
    #
    # Start Tomcat
    #
    $DAEMON_HOME/jsvc \
    -user $TOMCAT_USER \
    -home $JAVA_HOME \
    -Dcatalina.home=$CATALINA_HOME \
    -Dcatalina.base=$CATALINA_BASE \
    -Djava.io.tmpdir=$TMP_DIR \
    -wait 10 \
    -pidfile $PID_FILE \
    -outfile /var/tomcat/logs/catalina.out \
    -errfile /var/tomcat/logs/catalina.err \
    $JAVA_OPTS \
    $CATALINA_OPTS \
    -cp $CLASSPATH \
    org.apache.catalina.startup.Bootstrap
    #
    # To get a verbose JVM
    #-verbose \
    # To get a debug of jsvc.
    #-debug \
    chown -R xz_lan:xz_server /var/tomcat
    chown -R xz_lan:xz_server /var/tomcat/*
    exit $?
    ;;

  stop)
    #
    # Stop Tomcat
    #
    $DAEMON_HOME/jsvc \
    -stop \
    -pidfile $PID_FILE \
    org.apache.catalina.startup.Bootstrap
    exit $?
    ;;

  *)
    echo "Usage tomcat.sh start/stop"
    exit 1;;
esac

Tomcat后台服务(开机启动)Shell代码,安装过程请参照上一篇

上一篇:LA 3211 Now or later / 2-SAT


下一篇:Adobe CC 中文版 全系列官方下载地址