• Tomcat 设置内存大小


    jrhapt12:/etc/init.d# cat tomcat8082 
    #!/bin/sh
    #
    # tomcat: Start/Stop/Restart tomcat
    #
    # chkconfig: 2345 80 20
    # description: Tomcat is a Java Servlet Container
    #
    #
    # match these values to your environment:
    export CATALINA_BASE=/usr/local/apache-tomcat-7.0.55_8082
    export CATALINA_HOME=/usr/local/apache-tomcat-7.0.55_8082
    export CATALINA_TMPDIR=/usr/local/apache-tomcat-7.0.55_8082/temp
    export JAVA_HOME=/usr/java/jdk1.8.0_20
    
    
    
    # Source function library.
    . /etc/rc.d/init.d/functions
    
    TOMCAT=/usr/local/apache-tomcat-7.0.55_8082
    
    start() {
    	echo -n $"Starting Tomcat: "
    	su - tomcat  -c "$TOMCAT/bin/catalina.sh start"
    }
    
    stop() {
    	echo -n $"Stopping Tomcat: "
    	su - tomcat -c "$TOMCAT/bin/catalina.sh stop"
    
    }
    
    status() {
    	ps ax --width=1000 | grep "[o]rg.apache.catalina.startup.Bootstrap start" | grep '_8082' | awk '{printf $1 " "}' | wc | awk '{print $2}' > /tmp/tomcat8082_process_count.txt
    	read line < /tmp/tomcat8082_process_count.txt
    	if [ $line -gt 0 ]
    	then
    		echo -n "tomcat ( pid "
    		ps ax --width=1000 | grep "org.apache.catalina.startup.Bootstrap start" | grep '_8082' | awk '{printf $1 " "}'
    		echo -n ") is running..."
    		echo
    	else
    		echo "tomcat8082 is stopped"
    	fi
    }
    
    # See how we were called.
    case "$1" in
    start)
    	start ;;
    stop)
    	stop ;;
    status)
    	status ;;
    restart)
    	stop; sleep 10; start ;;
    *)
    	echo $"Usage: $0 {start|stop|status|restart}" ;;
    esac
    
    exit $RETVAL
    
    
    ------------------------------------------------------------------
    jrhapt12:/usr/local/apache-tomcat-7.0.55_8082/bin# cat catalina.sh 
    #!/bin/sh
    
    # Licensed to the Apache Software Foundation (ASF) under one or more
    # contributor license agreements.  See the NOTICE file distributed with
    # this work for additional information regarding copyright ownership.
    # The ASF licenses this file to You 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.
    
    # -----------------------------------------------------------------------------
    # Control Script for the CATALINA Server
    #
    # Environment Variable Prerequisites
    #
    #   Do not set the variables in this script. Instead put them into a script
    #   setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
    #
    #   CATALINA_HOME   May point at your Catalina "build" directory.
    #
    #   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions
    #                   of a Catalina installation.  If not present, resolves to
    #                   the same directory that CATALINA_HOME points to.
    #
    #   CATALINA_OUT    (Optional) Full path to a file where stdout and stderr
    #                   will be redirected.
    #                   Default is $CATALINA_BASE/logs/catalina.out
    #
    #   CATALINA_OPTS   (Optional) Java runtime options used when the "start",
    #                   "run" or "debug" command is executed.
    #                   Include here and not in JAVA_OPTS all options, that should
    #                   only be used by Tomcat itself, not by the stop process,
    #                   the version command etc.
    #                   Examples are heap size, GC logging, JMX ports etc.
    #
    #   CATALINA_TMPDIR (Optional) Directory path location of temporary directory
    #                   the JVM should use (java.io.tmpdir).  Defaults to
    #                   $CATALINA_BASE/temp.
    #
    #   JAVA_HOME       Must point at your Java Development Kit installation.
    #                   Required to run the with the "debug" argument.
    #
    #   JRE_HOME        Must point at your Java Runtime installation.
    #                   Defaults to JAVA_HOME if empty. If JRE_HOME and JAVA_HOME
    #                   are both set, JRE_HOME is used.
    #
    #   JAVA_OPTS       (Optional) Java runtime options used when any command
    #                   is executed.
    #                   Include here and not in CATALINA_OPTS all options, that
    #                   should be used by Tomcat and also by the stop process,
    #                   the version command etc.
    #                   Most options should go into CATALINA_OPTS.
    #
    #   JAVA_ENDORSED_DIRS (Optional) Lists of of colon separated directories
    #                   containing some jars in order to allow replacement of APIs
    #                   created outside of the JCP (i.e. DOM and SAX from W3C).
    #                   It can also be used to update the XML parser implementation.
    #                   Defaults to $CATALINA_HOME/endorsed.
    #
    #   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"
    #                   command is executed. The default is "dt_socket".
    #
    #   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"
    #                   command is executed. The default is 8000.
    #
    #   JPDA_SUSPEND    (Optional) Java runtime options used when the "jpda start"
    #                   command is executed. Specifies whether JVM should suspend
    #                   execution immediately after startup. Default is "n".
    #
    #   JPDA_OPTS       (Optional) Java runtime options used when the "jpda start"
    #                   command is executed. If used, JPDA_TRANSPORT, JPDA_ADDRESS,
    #                   and JPDA_SUSPEND are ignored. Thus, all required jpda
    #                   options MUST be specified. The default is:
    #
    #                   -agentlib:jdwp=transport=$JPDA_TRANSPORT,
    #                       address=$JPDA_ADDRESS,server=y,suspend=$JPDA_SUSPEND
    #
    #   CATALINA_PID    (Optional) Path of the file which should contains the pid
    #                   of the catalina startup java process, when start (fork) is
    #                   used
    #
    #   LOGGING_CONFIG  (Optional) Override Tomcat's logging config file
    #                   Example (all one line)
    #                   LOGGING_CONFIG="-Djava.util.logging.config.file=$CATALINA_BASE/conf/logging.properties"
    #
    #   LOGGING_MANAGER (Optional) Override Tomcat's logging manager
    #                   Example (all one line)
    #                   LOGGING_MANAGER="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager"
    # -----------------------------------------------------------------------------
    
    JAVA_OPTS='-Xms8192m -Xmx8192m' ---设置内存大小
    export JAVA_HOME=/usr/java/jdk1.8.0_20
    
    # OS specific support.  $var _must_ be set to either true or false.
    cygwin=false
    darwin=false
    os400=false
    case "`uname`" in
    CYGWIN*) cygwin=true;;
    Darwin*) darwin=true;;
    OS400*) os400=true;;
    esac
    
    
    
    

  • 相关阅读:
    Windows Azure 网站 (WAWS) 中的服务器端包含 (SSI)
    Windows Azure 即将更名
    由世纪互联运营的 Windows Azure 现已在中国正式发布
    Windows Azure 存储的冗余存储选项和只读访问跨地域冗余存储
    Azure 网站的新增功能:可配置的环境变量
    cocos2dx中的其他层
    日期类型的特殊性 -- 日期函数转换
    now()与sysdate()的区别(1)
    定义变量时无引号,单引号,双引号区别与特点
    把一个命令的结果作为变量内容赋值方法
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13351712.html
Copyright © 2020-2023  润新知