Linux下定期清空被正在运行服务占用的日志文件
linux下定期删除日志:
运用linux下的while true循环,加上echo "" > ***.log 完成
while :; do
#echo "" > nohup.out
# ls "dir" -lR |grep -v ^d|awk '{print $9}' |tr -s '\n' > ./list.txt
# echo "text"| tee $(find $(pwd) -name "*.out") > /dev/null
# echo "text"| tee -a $(cat ./list.txt) > /dev/null
echo $(date +%F%n%T)| tee $(find $(pwd) -name "*.out") > /dev/null # 输入内容替换为“”
# find $(pwd) -name "*.out"
echo $(date +%F%n%T)
echo "log clear end"
sleep 5s
done

浙公网安备 33010602011771号