2022-11-05 08:27:27

This commit is contained in:
2022-11-05 08:27:27 -04:00
parent 9b94a6fd76
commit 317257264a

View File

@@ -177,21 +177,18 @@ else
echo "full restorion selected: comparisons will not be made, all non-excluded databases will be restored" echo "full restorion selected: comparisons will not be made, all non-excluded databases will be restored"
fi fi
echo "\nfinding files in '$NEWPATH*.gz'" echo -e "\nfinding files in '$NEWPATH*.gz'"
for FILE in $NEWPATH*.gz; do for FILE in $NEWPATH*.gz; do
STARTLOOP=$(date +%s) STARTLOOP=$(date +%s)
FILE=$(basename $FILE) FILE=$(basename $FILE)
echo -e "\n$(date +%F\ %T) | $FILE:" echo -e "\n$(date +%F\ %T) | $FILE:"
if [[ "${SETPOSDB}" =~ ${FILE%%.*} ]]; then echo -e "\t-- recognized $FILE for master position and log file" if [[ "${SETPOSDB}" =~ ${FILE%%.*} ]]; then echo -e "\t-- recognized '$FILE' for master position and log file"
SETPOSFILE=$(realpath $FILE) SETPOSFILE=$NEWPATH$FILE
SETPOSSTMT=$(zcat $SETPOSFILE | head -40 | grep MASTER | sed 's/-- //') SETPOSSTMT=$(zcat $SETPOSFILE | head -40 | grep MASTER | sed 's/-- //')
echo -e "\n$SETPOSSTMT\n" echo -e "\t$SETPOSSTMT"
exit 2
fi fi
exit 1
if [[ "${SKIPDBS[*]}" =~ ${FILE%%.*} ]]; then echo -e "\t-- skipping $FILE";continue; fi; if [[ "${SKIPDBS[*]}" =~ ${FILE%%.*} ]]; then echo -e "\t-- skipping $FILE";continue; fi;
if [[ FULLRESTORE == false ]]; then if [[ FULLRESTORE == false ]]; then
@@ -216,18 +213,18 @@ for FILE in $NEWPATH*.gz; do
printf '\t%02dh:%02dm:%02ds\n' $((EXCTIME/3600)) $((EXCTIME%3600/60)) $((EXCTIME%60)) printf '\t%02dh:%02dm:%02ds\n' $((EXCTIME/3600)) $((EXCTIME%3600/60)) $((EXCTIME%60))
done done
if [[ -n MASTER_HOST ]] && [[ -n MASTER_USER ]] && [[ -n MASTER_PASSWORD ]]; then if [[ $MASTER_HOST && $MASTER_USER && $MASTER_PASSWORD ]]; then
echo -e "applying configuration for replication\n\thost: $MASTER_HOST\n\tuser: $MASTER_USER" echo -e "\napplying configuration for replication\n\thost: $MASTER_HOST\n\tuser: $MASTER_USER"
$CMD mysql -e "CHANGE MASTER TO master_host='$MASTER_HOST',master_user='$MASTER_USER',master_password='$MASTER_PASSWORD';" $CMD mysql -e "CHANGE MASTER TO master_host='$MASTER_HOST',master_user='$MASTER_USER',master_password='$MASTER_PASSWORD';"
else else
echo "replication credentials not configured" echo "\nreplication credentials not configured"
fi fi
if [[ -n $SETPOSSTMT ]]; then if [[ $SETPOSSTMT ]]; then
$CMD mysql -e "$SETPOS" $CMD mysql -e "$SETPOSSTMT"
else else
DONOTSTART=true DONOTSTART=true
echo "master position database undefined, listing suggestions" echo "\nmaster position database undefined, listing suggestions"
for FILE in $NEWPATH*.gz; do for FILE in $NEWPATH*.gz; do
echo $(basename $FILE) echo $(basename $FILE)
echo -e "\t$(zcat $FILE | head -40 | grep MASTER)" echo -e "\t$(zcat $FILE | head -40 | grep MASTER)"