diff --git a/restore-mysql-daily b/restore-mysql-daily index 8592268..303844e 100644 --- a/restore-mysql-daily +++ b/restore-mysql-daily @@ -172,7 +172,7 @@ NEWPATH="$ARCHPATH$NEWDATE/$SUBDIR" if [[ $FULLRESTORE == false ]]; then OLDDATE=$(ls -1rt "$ARCHPATH" | head -1) OLDPATH="$ARCHPATH$OLDDATE/$SUBDIR" - echo "compartive restoration selected:\n\tfiles from:\t'$NEWDATE'\n\tcompared to:\t'$OLDDATE'" + echo -e "compartive restoration selected:\n\tfiles from:\t'$NEWDATE'\n\tcompared to:\t'$OLDDATE'" else echo "full restorion selected: comparisons will not be made, all non-excluded databases will be restored" fi @@ -181,8 +181,10 @@ echo "\nfinding files in '$NEWPATH*.gz'" for FILE in $NEWPATH*.gz; do if [[ "${SETPOSDB}" =~ ${FILE%%.*} ]]; then echo -e "\t-- recognized $FILE for master position and log file" SETPOSFILE=$(realpath $FILE) - echo -e "\tposition file: $SETPOSFILE" - fi; + SETPOSSTMT=$(zcat $SETPOSFILE | head -40 | grep MASTER | sed 's/-- //') + echo -e "\n$SETPOSSTMT\n" + exit + fi FILE=$(basename $FILE) STARTLOOP=$(date +%s) @@ -220,9 +222,7 @@ else echo "replication credentials not configured" fi -if [[ -n $SETPOSFILE ]]; then - SETPOSSTMT=$(zcat $SETPOSFILE | head -40 | grep MASTER | sed 's/-- //') - echo -e "\n$SETPOSSTMT\n" +if [[ -n $SETPOSSTMT ]]; then $CMD mysql -e "$SETPOS" else DONOTSTART=true