• centOS6.5 修改catalina.sh使用crontab自动切割日志tomcat8


    1、添加LD_LIBRARY_PATH

    #!/bin/sh
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib
    export LD_LIBRARY_PATH

    2、修改jvm参数

    # OS specific support. $var _must_ be set to either true or false.
    #export JAVA_OPTS="-server -Dfile.encoding=UTF-8 -Duser.language=zh_CN -Xms1196M -Xmx1196M -Xmn548M -Xss512K -XX:+AggressiveOpts -XX:+UseBiasedLocking -XX:PermSize=88M -XX:MaxPermSize=106M -XX:SurvivorRatio=2 -XX:MaxTenuringThreshold=30 -XX:LargePageSizeInBytes=64m -XX:+UseParallelOldGC -XX:GCTimeRatio=9 -Djava.awt.headless=true -Duser.timezone=GMT+08"
    export JAVA_OPTS="-server -Dfile.encoding=UTF-8 -Duser.language=zh_CN -Xms3048M -Xmx3048M -Xmn1452M -XX:+AggressiveOpts -XX:+UseBiasedLocking -XX:PermSize=70M -XX:MaxPermSize=90M -XX:+DisableExplicitGC -XX:MaxTenuringThreshold=31 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+UseCMSCompactAtFullCollection -XX:LargePageSizeInBytes=64m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -Djava.awt.headless=true -Duser.timezone=GMT+08"

    3、引入crontab日志切割

    touch "$CATALINA_OUT"
    if [ "$1" = "-security" ] ; then
    if [ $have_tty -eq 1 ]; then
    echo "Using Security Manager"
    fi
    shift
    eval $_NOHUP ""$_RUNJAVA"" ""$LOGGING_CONFIG"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
    -classpath ""$CLASSPATH""
    -Djava.security.manager
    -Djava.security.policy==""$CATALINA_BASE/conf/catalina.policy""
    -Dcatalina.base=""$CATALINA_BASE""
    -Dcatalina.home=""$CATALINA_HOME""
    -Djava.io.tmpdir=""$CATALINA_TMPDIR""
    org.apache.catalina.startup.Bootstrap "$@" start
    >> "$CATALINA_OUT" 2>&1 "&"

    else
    eval $_NOHUP ""$_RUNJAVA"" ""$LOGGING_CONFIG"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
    -classpath ""$CLASSPATH""
    -Dcatalina.base=""$CATALINA_BASE""
    -Dcatalina.home=""$CATALINA_HOME""
    -Djava.io.tmpdir=""$CATALINA_TMPDIR""
    org.apache.catalina.startup.Bootstrap "$@" start

    >> "$CATALINA_OUT" 2>&1 "&"


    修改为:

    # touch "$CATALINA_OUT"
    if [ "$1" = "-security" ] ; then
    if [ $have_tty -eq 1 ]; then
    echo "Using Security Manager"
    fi
    shift
    eval $_NOHUP ""$_RUNJAVA"" ""$LOGGING_CONFIG"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
    -classpath ""$CLASSPATH""
    -Djava.security.manager
    -Djava.security.policy==""$CATALINA_BASE/conf/catalina.policy""
    -Dcatalina.base=""$CATALINA_BASE""
    -Dcatalina.home=""$CATALINA_HOME""
    -Djava.io.tmpdir=""$CATALINA_TMPDIR""
    org.apache.catalina.startup.Bootstrap "$@" start

    2>&1 |/usr/local/sbin/cronolog "$CATALINA_BASE/logs/catalina-%Y-%m-%d.out" &

    else
    eval $_NOHUP ""$_RUNJAVA"" ""$LOGGING_CONFIG"" $LOGGING_MANAGER $JAVA_OPTS $CATALINA_OPTS
    -classpath ""$CLASSPATH""
    -Dcatalina.base=""$CATALINA_BASE""
    -Dcatalina.home=""$CATALINA_HOME""
    -Djava.io.tmpdir=""$CATALINA_TMPDIR""
    org.apache.catalina.startup.Bootstrap "$@" start

    2>&1 |/usr/local/sbin/cronolog "$CATALINA_BASE/logs/catalina-%Y-%m-%d.out" &

  • 相关阅读:
    python functools模块
    python 垃圾回收详解
    python与鸭子类型
    简单写一下图片上传获取宽高的方法
    手写一个简单的webpack的配置
    immutable的使用
    react中实现异步请求的方法二、redux-promise-middleware
    react中实现异步请求的方法一,react-thunk
    浅谈vuex。
    Vue中插槽的使用。
  • 原文地址:https://www.cnblogs.com/bury12/p/7188366.html
Copyright © 2020-2023  润新知