Commit e944fa9f authored by 白秀江's avatar 白秀江

更新log_history_rm_x_days.sh

parent e1f193c4
#!/bin/bash
starttime=`date +'%Y-%m-%d %H:%M:%S'`
logdir=$1
days=$2
old_day=`date +%Y-%m-%d -d"$days days"`
filename=$logdir/*$old_day*
rm -fr $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