腳本文件:
PS3="please in put number is back mysql mode: "
select num in mysqldump xtraback quit;do
case $REPLY in
1)
mysqldump -A --master-data=2 -F --single-transaction ?-q |gzip ?> /data/mysql-`date +%F`.sql.gz
echo "mysqldump-all-databses successful"
break
;;
2)
mkdir /data/xrabackup-`date +%F`
xtrabackup --backup --target-dir=/data/xrabackup-`date +%F` &> /dev/null
echo "xtrabackup-all-databases successful"
break
;;
3)
break
;;
*)
echo "please choice 1 or 2 or 3"
esac
done
驗(yàn)證: