Commit 316f310d authored by 白秀江's avatar 白秀江

更新log_rm.sh

parent dd191ca7
#!/bin/bash
starttime=`date +'%Y-%m-%d %H:%M:%S'`
logdir=/data/test/logs
old_day=`date +%Y%m%d -d"-7 days"`
filename=$logdir/*-$old_day*
rm -f $filename
echo " 删除文件: $filename"
endtime=`date +'%Y-%m-%d %H:%M:%S'`
start_seconds=$(date --date="$starttime" +%s);
end_seconds=$(date --date="$endtime" +%s);
echo " 开始时间: $starttime "
echo " 结束时间: $endtime "
echo " 本次运行时间: "$((end_seconds-start_seconds))"s"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment