#!/bin/bash dbfile=$(echo /data/backup/db/db_`date '+%Y-%m-%d'`.sql.gz) mysqldump -h localhost -u root -pxxxx xxxdbname --ignore-table=xxxdbname.ignoretablename |gzip >${dbfile} filedel=$(echo /data/backup/db/db_`date -d '-1 month' '+%Y-%m-%d'`.sql.gz) if [ -f ${filedel} ];then echo "test文件存在, delete file exceed a month" rm -f ${filedel} fi cp -f ${dbfile} /tmp/
Linux下mysql自动循环备份脚本
最新推荐文章于 2024-05-29 15:08:06 发布