jdk和tomcat环境部署,以及tomcat的日志切割
cd /data/soft/
apache-tomcat-9.0.0.M17.tar.gz
jdk-8u60-linux-x64.tar.gz
tar xf jdk-8u60-linux-x64.tar.gz -C /usr/local/
ln -s /usr/local/jdk1.8.0_60/bin/java /sbin/java
sed -i.ori'$a export JAVA_HOME=/usr/local/jdk1.8.0_60\nexportPATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH\nexportCLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar'/etc/profile
source /etc/profile
java -version
4.2安装tomcat9
tar xf apache-tomcat-9.0.0.M17.tar.gz /usr/local/
ln -s /usr/local/apache-tomcat-9.0.0.M17//usr/local/tomcat9
echo 'export TOMCAT_HOME=/usr/local/tomcat9'>>/etc/profile
source /etc/profile
[root@llqHT local]# tail -4 /etc/profile
export JAVA_HOME=/usr/local/jdk1.8.0_60
exportPATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:/usr/local/redis/bin/:$PATH
exportCLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
export TOMCAT_HOME=/usr/local/tomcat9
/usr/local/tomcat9/bin/startup.sh
/usr/local/tomcat9/bin/shutdown.sh
4.3授权普通用户启动tomcat9
Useradd rusheng
chown -R rusheng.rusheng/usr/local/jdk1.8.0_60 /usr/local/apache-tomcat-9.0.0.M17
4.4tomcat9日志切割
[root@llqHT bin]# cat -n catalina.sh|sed -n'205,212p;423p;436,440p;447,451p'
205 #if [ -z "$CATALINA_OUT" ] ; then
206 # CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out
207 #fi
208 ###tomcat9 cut catalina.out by jianwei2017-02-23###
209 if [ -z "$CATALINA_OUT" ] ; then
210 CATALINA_OUT="$CATALINA_BASE"/logs/catalina.%Y-%m-%d.out
211 fi
212
423 #touch "$CATALINA_OUT"
436 ## org.apache.catalina.startup.Bootstrap "$@" start \
437 ## >>"$CATALINA_OUT" 2>&1 "&"
438 org.apache.catalina.startup.Bootstrap "$@" start 2>&1 \
439 | /usr/local/sbin/cronolog "$CATALINA_OUT" >> /dev/null&
440
447 ## org.apache.catalina.startup.Bootstrap "$@" start \
448 ## >>"$CATALINA_OUT" 2>&1 "&"
449 org.apache.catalina.startup.Bootstrap "$@" start 2>&1 \
450 | /usr/local/sbin/cronolog "$CATALINA_OUT" >> /dev/null&
451