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

@@ -54,11 +54,21 @@ if [ -z "$pg_dump" ]; then
pg_dump="/usr/local/pgsql/bin/pg_dump"
fi
err_msg="Determin existing databases failed"
if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then
DATABASES=`$ssh ${ssh_user}@$srcHost "$sudo -u $pgsql_user $psql -lt" \
| $grep -v -e"^$" | $awk '{print$1}'`
DATABASES="$($ssh ${ssh_user}@$srcHost "$sudo -u $pgsql_user $psql -lt" \
| $grep -v -e"^$" | $awk '{print$1}' 2> /tmp/error)"
retval=$?
else
DATABASES=`$su - $pgsql_user -c "$psql -lt" | $grep -v -e"^$" | $awk '{print$1}'`
DATABASES="$($su - $pgsql_user -c "$psql -lt" | $grep -v -e"^$" | $awk '{print$1}' 2> /tmp/error)"
retval=$?
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
@@ -131,6 +141,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
@@ -223,6 +234,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
@@ -324,6 +336,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