欢迎各位兄弟 发布技术文章
这里的技术是共享的
[root@js1p-es-web ~]# vim delete_backup_web.sh
#!/bin/bash
#
num=`ls -l /backup/web | grep ".tar.gz" | wc -l`
# if count file more than 10 ,delete file
if [ $num -gt 8 ];then
/usr/bin/find /backup/web -mtime +7 -name "*.tar.gz" -exec /usr/bin/rm -rf {} \;
fi
[root@js1p-es-web ~]# vim delete_backup_mysql.sh
#!/bin/bash
#
num=`ls -l /backup/mysql | grep ".sql" | wc -l`
# if count file more than 10 ,delete file
if [ $num -gt 8 ];then
/usr/bin/find /backup/mysql -mtime +7 -name "*.sql" -exec /usr/bin/rm -rf {} \;
fi
~