查找大文件並清空
cat /data/application/scripts/autoclean_nohup.out.shbash
#!/bin/bash #按期清理日誌文件超過1G--nohup.out #by licb @20190222 for i in `find ./ -type f -size +1000M -name nohup.out` do cat /dev/null > $i ls -lh $i done
[root@netshop-vm2 scripts]# crontab -l * * * * 7 root /bin/bash /data/application/scripts/autoclean_nohup.out.sh
find ./ -type f -size +1000M -name nohup.out -exec rm -rf {}\;
find ./ -type f -size +1000M -name nohup.out | xargs ls -l
app