时间:2021-07-01 10:21:17 帮助过:26人阅读
#!/bin/bash #备份数据库hz jshuabo sdhuabo name=$(date +%Y%m%d) /alidata/server/mysql-5.1.73/bin/mysqldump -u root -p123456 hz > /root/sqlBackup/hz.$name.sql /alidata/server/mysql-5.1.73/bin/mysqldump -u root -p123456 jshuabo > /root/sqlBackup/jshuabo.$name.sql /alidata/server/mysql-5.1.73/bin/mysqldump -u root -p123456 sdhuabo > /root/sqlBackup/sdhuabo.$name.sql #删除一周之前的备份文件 file_path="/root/sqlBackup" #方法a #rm -rf `find $file_path ‘*.sql‘ -mitime 7 -print` > delete.log; #方法b find $file_path -mtime +7 -type f|xargs rm -f #方法c #rm -f `find $file_path -mtime +7 -type f`
linux 下备份MySQL数据库 并删除7天前的备份数据
标签:mod linu find pos pop backup 1.7 type mysql数据库