数据库备份脚本

#!/bin/bash
day2=`date "+%Y-%m-%d" -d "-2 day"`
rm -rf /dfs1/bak/full/$day2*
echo $day2
innobackupex --defaults-file=/etc/my.cnf --user=root --password=******* /dfs1/bak/full/

 

 

#!/bin/bash
day=`date +%Y-%m-%d`
cd /dfs1/bak/full
day1=`ls |grep $day`
echo $day1
day2=`date "+%Y-%m-%d" -d "-2 day"`
rm -rf /dfs1/bak/backadd/$day2*
echo $day2

innobackupex --defaults-file=/etc/my.cnf --user=root --password=******  --incremental /dfs1/bak/backadd/ --incremental-basedir=/dfs1/bak/full/$day1

posted on 2018-10-26 15:22  net2817  阅读(131)  评论(0编辑  收藏  举报

导航