#!/bin/bash
# 设置日志文件路径数组
log_files=(
"/home/apache-tomcat-8.5.97/logs/catalina.out"
"/home/load/washdata/log/washdata.out"
"/home/load/load-jt808/log/load_jt808Serve.out"
# 添加更多日志文件路径...
)
# 遍历日志文件数组,清空每个日志文件
# echo "Log file $log_file cleared at $(date)" >> /home/tool/clear_log_script.log 清除日志的日志
for log_file in "${log_files[@]}"; do
echo -n > "$log_file"
echo "Log file $log_file cleared at $(date)" >> /home/tool/clear_log_script.log
done
放到linux虚拟机中,然后执行 此脚本