码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2017-07-16 00:02:31      阅读:739      评论:0      收藏:0      [点我收藏+]

标签:hup   perm   collect   xss   shift   bsp   enable   cal   parallel   

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" &

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

标签:hup   perm   collect   xss   shift   bsp   enable   cal   parallel   

原文地址:http://www.cnblogs.com/bury12/p/7188366.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!