系统长时间的备份会产生大量的过时文件
#!/bin/bash
logback_path=/home/rzrk/server/logbackup/
logback_30day_ago=`find -mtime +30`
cd $logback_path
echo -e ‘正在搜索30天以前的文件‘
sleep 1
find -mtime +30
while read -p ‘Please Enter to Delete files[Y/N]:‘ choose
do
if [ "$choose" == y ];
then
echo -e ‘\n以上文件即将被删除‘
sleep 1
echo -e ‘\n正在删除30天以前的备份loading……‘
rm -rf $logback_30day_ago
sleep 1
echo -e ‘\n删除完毕‘
break;
else [ "$choose" == n ];
echo ‘文件未删除‘
sleep 1
break;
fi
done
本文出自 “Linux钻研中心” 博客,请务必保留此出处http://mysuffer.blog.51cto.com/10712829/1712486
原文地址:http://mysuffer.blog.51cto.com/10712829/1712486