time=$(date +%H)
end_time=`expr $time – 2`
a=$end_time
BF_TIME=$(date +%Y%m%d)_$a:00-$time:00
cp /usr/local/tomcat8/logs/catalina.out /var/log/tomcat/oldlog/catalina.$BF_TIME.out
echo ” ” > /usr/local/tomcat8/logs/catalina.out
catalina.out
mkdir -p /var/log/tomcat/oldlog/
chmod +x /root/tom_log.sh
crontab -e
0 */2 * * * sh /root/tom_log.sh
ls /var/log/tomcat/oldlog/
catalina.20190102_15:00-17:00.out catalina.20190102_17:00-19:00.out
Recent Comments