From fb6589a07bb461e3dc8bfd0ed22ae99c99361b12 Mon Sep 17 00:00:00 2001 From: diandian Date: Fri, 25 Aug 2023 11:42:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'Shell-MD'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Shell-MD/xtrabackup.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Shell-MD/xtrabackup.sh diff --git a/Shell-MD/xtrabackup.sh b/Shell-MD/xtrabackup.sh new file mode 100644 index 0000000..1e2032c --- /dev/null +++ b/Shell-MD/xtrabackup.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +#write by blackmed +#xtrabackup +read -p "请输入mysql的root密码:" mima +time=`date +%a` +if [ "${time}" == "Mon" ];then + mkdir /backup/full -p + innobackupex --user=root --password=${mima} /backup/full/ +elif [ "${time}" == "Tue" ];then + cd /backup/full/;ls >/tmp/a.txt + mkdir /backup/zeng + file1=`cat /tmp/a.txt | sed '/^$/!h;$!d;g'` + innobackupex --user=root --password=${mima} --incremental /backup/zeng/ --incremental-basedir=/backup/full/${file1} + +elif [ "${time}" == "Wed" ];then + cd /backup/zeng;ls >/tmp/a.txt + file2=`cat /tmp/a.txt | sed '/^$/!h;$!d;g'` + innobackupex --user=root --password=${mima} --incremental /backup/zeng/ --incremental-basedir=/backup/zeng/${file2} + +elif [ "${time}" == "Thu" ];then + cd /backup/zeng;ls >/tmp/a.txt + file3=`cat /tmp/a.txt | sed '/^$/!h;$!d;g'` + innobackupex --user=root --password=${mima} --incremental /backup/zeng/ --incremental-basedir=/backup/zeng/${file3} + +elif [ "${time}" == "Fri" ];then + cd /backup/zeng;ls >/tmp/a.txt + file4=`cat /tmp/a.txt | sed '/^$/!h;$!d;g'` + innobackupex --user=root --password=${mima} --incremental /backup/zeng/ --incremental-basedir=/backup/zeng/${file4} + +elif [ "${time}" == "Sat" ];then + cd /backup/zeng;ls >/tmp/a.txt + file5=`cat /tmp/a.txt | sed '/^$/!h;$!d;g'` + innobackupex --user=root --password=${mima} --incremental /backup/zeng/ --incremental-basedir=/backup/zeng/${file5} + +elif [ "${time}" == "Sun" ];then + cd /backup/zeng;ls >/tmp/a.txt + file6=`cat /tmp/a.txt | sed '/^$/!h;$!d;g'` + innobackupex --user=root --password=${mima} --incremental /backup/zeng/ --incremental-basedir=/backup/zeng/${file6} +else + echo ${time} +fi