Print additional infos about errors to std_out.

This commit is contained in:
2019-06-09 17:08:15 +02:00
parent 7013d8644f
commit ef5848f4ea
8 changed files with 105 additions and 14 deletions

View File

@@ -118,24 +118,56 @@ fi
# ------------------ Ende Variable ------------------ #
# --------------------------------------------------- #
err_msg="Determin existing databases failed"
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
if [ -n "$mysql_credential_args" ] ; then
DATABASES=`$ssh ${ssh_user}@$srcHost "$mysql $mysql_credential_args -N -s -e \"show databases\""`
MYSQL_VERSION=`$ssh ${ssh_user}@$srcHost "$mysql $mysql_credential_args -N -s -e \"SELECT VERSION()\""`
DATABASES="$($ssh ${ssh_user}@$srcHost "$mysql $mysql_credential_args -N -s -e \"show databases\"" 2> $err_Log)"
retval=$?
else
DATABASES=`$ssh ${ssh_user}@$srcHost "$mysql -u$mysql_user -p$mysql_password -N -s -e \"show databases\""`
MYSQL_VERSION=`$ssh ${ssh_user}@$srcHost "$mysql -u$mysql_user -p$mysql_password -N -s -e \"SELECT VERSION()\""`
DATABASES="$($ssh ${ssh_user}@$srcHost "$mysql -u$mysql_user -p$mysql_password -N -s -e \"show databases\"" 2> $err_Log)"
retval=$?
fi
else
if [ -n "$mysql_credential_args" ] ; then
DATABASES=`$mysql $mysql_credential_args -N -s -e "show databases"`
MYSQL_VERSION=`$mysql $mysql_credential_args -N -s -e "SELECT VERSION()"`
DATABASES="$($mysql $mysql_credential_args -N -s -e "show databases" 2> $err_Log)"
retval=$?
else
DATABASES=`$mysql -u$mysql_user -p$mysql_password -N -s -e "show databases"`
MYSQL_VERSION=`$mysql -u$mysql_user -p$mysql_password -N -s -e "SELECT VERSION()"`
DATABASES="$($mysql -u$mysql_user -p$mysql_password -N -s -e "show databases" 2> $err_Log)"
retval=$?
fi
fi
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg}\n\t $(cat $err_Log)\n"
fi
err_msg="Determine version information about MySQL/MariaDB failed."
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
if [ -n "$mysql_credential_args" ] ; then
MYSQL_VERSION="$($ssh ${ssh_user}@$srcHost "$mysql $mysql_credential_args -N -s -e \"SELECT VERSION()\"" 2> $err_Log)"
retval=$?
else
MYSQL_VERSION=`$ssh ${ssh_user}@$srcHost "$mysql -u$mysql_user -p$mysql_password -N -s -e \"SELECT VERSION()\""`
retval=$?
fi
else
if [ -n "$mysql_credential_args" ] ; then
MYSQL_VERSION="$($mysql $mysql_credential_args -N -s -e "SELECT VERSION()" 2> $err_Log)"
retval=$?
else
MYSQL_VERSION="$($mysql -u$mysql_user -p$mysql_password -N -s -e "SELECT VERSION()" 2> $err_Log)"
retval=$?
fi
fi
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg}\n\t $(cat $err_Log)\n"
fi
MYSQL_VERSION_NUM=`echo $MYSQL_VERSION | awk -F \. '{ printf "%02d", $1; printf "%02d", $2; printf "%02d", $3 }'`
@@ -164,6 +196,7 @@ if $ARCHIVE ;then
## -----------------------------
## - Backup SQL Grants for users
## -
found_errors=false
info_msg="save SQL Grants for users"
echononl "\t$info_msg"
@@ -244,6 +277,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -362,6 +396,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -472,6 +507,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -583,6 +619,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -696,6 +733,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -805,6 +843,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -900,6 +939,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -1047,6 +1087,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then
@@ -1198,6 +1239,7 @@ if $ARCHIVE ;then
## - look about errors..
## -
if [ "$retval" != "0" ]; then
print_error_stdout "${err_msg}:\n $(cat $err_Log)"
echolog ""
echolog "\t[ERROR] ${err_msg} [ $duration ]\n\t`$cat $err_Log`\n"
if ! $keep_backup_on_error ; then