find /data1/filename*/ -name "cdr_idx_*" -mtime +1 -exec rm -f {} ;
脚本
#!/bin/bash
m=70
dbkeep=95
dbpercent=`df -h | grep data | grep sd | awk -F ' ' '{print $5}'| sed -e 's/%//'`
m=70
dbkeep=95
dbpercent=`df -h | grep data | grep sd | awk -F ' ' '{print $5}'| sed -e 's/%//'`
if [ $dbpercent -lt $dbkeep ]
then
echo "don't need del tables."
exit 0
fi
then
echo "don't need del tables."
exit 0
fi
cd /test
pwd
for ((i=1; i<=$m; i ++))
do
b=$(ls -d -lht *.mulu_name | tail -n 1)
rm -rf $b
echo $b has been delete
done
pwd
for ((i=1; i<=$m; i ++))
do
b=$(ls -d -lht *.mulu_name | tail -n 1)
rm -rf $b
echo $b has been delete
done
for ((i=1; i<=$m; i ++))
do
b=$(ls -lht *.wenjian_name |awk -F ' ' '{print $9}' | tail -n 1)
rm -rf $b
echo $b has been delete
done
do
b=$(ls -lht *.wenjian_name |awk -F ' ' '{print $9}' | tail -n 1)
rm -rf $b
echo $b has been delete
done