标签:func mobile mod odi function col home -o nbsp
tomcat-rotate.sh:
#!/bin/bash
log_path="/home/tomcat7-api/logs/"
expried_time=7
function delete_log() {
local currentDate=`date +%s`
for file in find $1 -name "*.log" -o -name "*.txt"
do
local name=$file
local modifyDate=$(stat -c %Z $file)
local logExistTime=$(($currentDate - $modifyDate))
logExistTime=$(($logExistTime/86400))
if [ $logExistTime -gt $expried_time ]; then
echo "File: " $name "Modify Date: " $modifyDate + "Exist Time: " $logExistTime + "Delete: yes"
rm -f $file
fi
done
}
delete_log /home/tomcat7-api/logs/
delete_log /home/tomcat7-mobile/logs/
delete_log /home/tomcat7-pay/logs/
delete_log /home/tomcat7-web/logs/
标签:func mobile mod odi function col home -o nbsp
原文地址:https://www.cnblogs.com/immense/p/11405394.html