Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 525 Bytes

删除脚本.md

File metadata and controls

27 lines (18 loc) · 525 Bytes

删除脚本

删除一天前的文件:

#!/bin/bash

start=$(date +%y-%m-%d-%H%M%m)
echo $start

File=/temp/delete_$start.txt
FilePath=/nsm/moloch/raw

echo $File
echo $FilePath

day=1

echo "输出日志文件:"
echo "sudo find $FilePath -mtime +$day -name '*.pcap' > $File"
sudo find $FilePath -mtime +$day -name '*.pcap' > $File

echo "删除日志文件:"
echo "sudo find $FilePath -mtime +$day -name '*.pcap' -exec rm -rf {} \;"
sudo find $FilePath -mtime +$day -name '*.pcap'  -exec rm -rf {} \;