#!/bin/bash
set timeout 36000
#program:
# This program is used for del 7days ago logs;
# Writen by lubing 2015-01-13 First release
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:
export PATH
/opt/jboss/bin/catalina.sh stop
mv /opt/jboss/logs/catalina.out /data/bakopt_jboss_logs_catalina.out/`date +%Y%m%d`_catalina.out
sleep 3600
/bin/touch /opt/jboss/logs/catalina.out
/bin/kill -9 `ps -ef |grep "/opt/jboss/runtime/bin/jboss" |awk -F" " '{print $2}'|awk 'NR==2 {print}'`
sleep 20
/opt/jboss/bin/catalina.sh start
[root@P_MONTHLY_APP001 ~]# cat /opt/jboss/logs/dell-7days-logs.sh
#!/bin/bash
#program:
# this program used for backup mysql_log and delete the 7 days ago logs!
# History:
# 2015/01/01 lubing First release
PATH=/bin:/sbin/:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
/bin/find /data/bakopt_jboss_logs_catalina.out -mtime +7 -name '*.out' -exec rm -rf {} ;