欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

自己亲自做的 备份 web 网站和mysql 数据库 有大用 有大大用 有大大大用

[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

~


普通分类: