Closed anhnongdan closed 7 years ago
Need to add clean_disk cron to this repo:
#!/bin/sh
lock=/tmp/clean_disk.lock
filelist=/tmp/fileslist.txt
#rm -rf /data/cdn/`date +%Y/%m/%d -d '1 day ago'`
rm -rf /data/logs/`date +%Y/%m/%d -d '1 day ago'`
rm -rf /data/logs_fpt/`date +%Y/%m/%d -d '1 day ago'`
if [ -f $lock ];then
locklast=`stat $lock -c "%Y"`
now=`date +%s`
dlay=`echo $now - $locklast | bc`
if [ $dlay -gt 120 ];then
rm -f $lock
fi
fi
if [ -f $lock ];then exit 0;fi
touch $lock
find /data/cdn -mindepth 4 -type d -mtime +1 | awk '!/thvl/' | while read dd;do echo $dd;rm -rf $dd;done
find /data/cdn -mindepth 5 -type f -mmin +1 | awk '!/thvl/' | while read dd;do echo $dd;rm -rf $dd;done
find /data/cdn -mindepth 4 -type d -mtime +1 -iname '*thvl*' | while read dd;do echo $dd;rm -rf $dd;done
#find /data/cdn -mindepth 4 -type d -mtime +1| awk '!/thvl/' | while read dd;do echo $dd;rm -rf $dd;done
rm -f $lock
Mr. Vu added #rm -rf /data/cdn/date +%Y/%m/%d -d '1 day ago'
and commented out the find /data/cdn commands. This caused the log to not be rotated.
Follow Mr.Vu's solution #14
VNPT server full disk because of log files from FPT.
=> need to review clean_disk cron