X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=bin%2Fmkmysqlslave;h=fa60b93cd5c3957b25b6d4ade5d7301ea1e11046;hb=c34c8fd3ad4a9d4b6657cd287b88b11cbecd7158;hp=e265c8bf5f77d4690b5ae8aba86db484eb29812f;hpb=f0c81e7e4b552e7d32cbed5550acb784bd546f22;p=MkMySqlDump.git diff --git a/bin/mkmysqlslave b/bin/mkmysqlslave index e265c8b..fa60b93 100755 --- a/bin/mkmysqlslave +++ b/bin/mkmysqlslave @@ -3,6 +3,12 @@ # mkmysqlslave -- import MySQL master data and start slave # 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") @@ -60,10 +66,10 @@ while [ $# -gt 0 ]; do esac done -if [ -z "$INFILE" -o ! -n "$INFILE" ]; then +if [ -z "$INFILE" ]; then Usage fi -if [ ! -r "$INFILE" ]; then +if [ ! -r "$INFILE" -a "$INFILE" != "-" ]; then echo "$NAME: Can't read \"$INFILE\"!" exit 1 fi @@ -78,9 +84,14 @@ if [ $r -ne 0 ]; then echo "Warning: FAILED to stop MySQL slave threads, code $r!" >&2 fi -echo "Importing \"$INFILE\" ..." echo "Start: $(date)" -mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH <"$INFILE"; r=$? +if [ "$INFILE" != "-" ]; then + echo "Importing \"$INFILE\" ..." + mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH <"$INFILE"; r=$? +else + echo "Importing from standard input ..." + mysql -h "$MYHOST" -u "$MYUSER" $PWSWITCH; r=$? +fi echo "End: $(date)" if [ $r -ne 0 ]; then echo "MySQL import FAILED, code $r!" >&2