X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=bin%2Fmkmysqldump;h=3a5ba19ee7366bb6b27e9770cce79504a053dbca;hb=4a9488518f4869d7f3d5ace07f4d9b744b6b55db;hp=bd76518a710fa3497237949c92d34d8c8424a9fa;hpb=8e01bf64e1527c25dded47e497646c180ce418b7;p=MkMySqlDump.git diff --git a/bin/mkmysqldump b/bin/mkmysqldump index bd76518..3a5ba19 100755 --- a/bin/mkmysqldump +++ b/bin/mkmysqldump @@ -3,6 +3,12 @@ # mkmysqldump -- dump MySQL (master) data # Copyright (c)2015 Alexander Barton # +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# Please read the file COPYING, README and AUTHORS for more information. +# NAME=$(basename "$0") @@ -109,7 +115,9 @@ while [ $# -gt 0 ]; do done echo "Dumping MySQL server on \"$MYHOST\" (user \"$MYUSER\"):" +echo echo "Started: $(date)" + umask 0077 [ -n "$MYPW" ] && PWSWITCH="--password='$MYPW'" || PWSWITCH="" @@ -128,13 +136,28 @@ if [ $? -ne 0 ]; then exit 1 fi +echo "Checking slave status ..." +Slave_IO_Running=""; Slave_SQL_Running="" +eval "$(echo 'SHOW SLAVE STATUS\G' | mysql | sed -n '/Running/p' | sed 's/: /=/g')" +if [ -n "$Slave_IO_Running" -o -n "$Slave_SQL_Running" ]; then + if [ "$Slave_IO_Running" = "Yes" -a "$Slave_SQL_Running" = "Yes" ]; then + echo "Server is running as MySQL slave, replication is Ok." + else + echo "Server is running as MySQL slave, but replication FAILED!" + ErrorNotice + exit 1 + fi +else + echo "Server is not running as MySQL slave. Ok." +fi + echo "Will dump the following databases:" for d in $DATABASES; do echo " - $d" done echo "Dumping SQL data to file \"$OUTFILE\" ..." -echo "Start date: $(date)" +echo "Beginning dump: $(date)" CMD="mysqldump \ -h $MYHOST \ -u $MYUSER \