# 当空间占用百分比大于某个指定值时,删除目录前指定的数量 if [ $percent -ge $percent_in ];then echo "need to remove file! occupy" $percent"%" "of" $dev_file cd $mount_dir file=`ls | sort | head -$file_del` rm $file cd - else echo "no need to remove file" fi # 当文件个数达到一定数量时删除前x个文件 if [ $file_count -ge $count_del ];then echo "need to remove file! occupy total" $count_del "files of" $dev_file cd $mount_dir file=`ls | sort | head -$file_del` rm $file cd - else echo "no need to remove file" fi
#file=`ls | sort | head -$file_del` #echo $file
echo "comand complete at" date echo "======================================"