赞
踩
#!/bin/bash export dir1=$(ls -t1 /data/full | head -n 1) export dir2=$(ls -t1 /data/incr | head -n 1) case $1 in #全量备份 full) [[ -d /data/full ]] || mkdir -pv /data/full innobackupex /data/full/ ;; #增量备份 incr) [[ -d /data/incr ]] || mkdir -pv /data/incr if [[ "`ls /data/incr/`" = "" ]];then innobackupex --incremental /data/incr --incremental-basedir=/data/full/$dir1 else innobackupex --incremental /data/incr --incremental-basedir=/data/incr/$dir2 fi ;; apply) innobackupex --apply-log --redo-only /data/full/$dir1 if [[ "`ls /data/incr/`" != "" ]];then for i in `ls /data/incr/ -t1 | tac`;do innobackupex --apply-log --redo-only /data/full/$dir1 --incremental-dir=/data/incr/$i done fi innobackupex --apply-log /data/full/$dir1 ;; esac
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。