diff --git a/inc_bash.sh b/inc_bash.sh index d076b059eb6c0e5cc4abf8094f7ac6d0fa0d012a..f299e4377b15ceb84279229854caa83f5d2db358 100755 --- a/inc_bash.sh +++ b/inc_bash.sh @@ -11,8 +11,8 @@ typeset -i rc=0 # Fetch returncode of last executed command. -# It summarizes all exitcodes into rc (= if any job failed it is <> 0) -# It stores the last exitcode in myrc +# - It summarizes all exitcodes into rc (= if any job failed it is <> 0) +# - It stores the last exitcode in myrc function fetchrc(){ myrc=$? rc=$rc+$myrc diff --git a/plugins/localdump/mysql.sh b/plugins/localdump/mysql.sh index 4f69c2523f2753e312806687e2fdb31eae23a516..82616a1c30cde85b05aabc18daf5be32fb0fb09d 100755 --- a/plugins/localdump/mysql.sh +++ b/plugins/localdump/mysql.sh @@ -93,15 +93,15 @@ function mysql.db.dump(){ "$_dbname" 2>&1 fetchrc >/dev/null - zgrep -iE "(CREATE|INSERT)" "$_dumpfile" >/dev/null - typeset -i local _rc2=$? - test $_rc2 -ne 0 && echo "ERROR: the dump does not contain any CREATE or INSERT statement." + if [ $myrc -eq 0 ]; then + zgrep -iE "(CREATE|INSERT)" "$_dumpfile" >/dev/null + fetchrc >/dev/null + test $myrc -ne 0 && echo "ERROR: no data - the dump doesn't contain any CREATE or INSERT statement." + fi - typeset -i local myrc+=$_rc2 test $myrc -eq 0 && mysql_COUNT_DUMPS+=1 test $myrc -eq 0 || mysql_COUNT_ERRORS+=1 - test $myrc -eq 0 } # import [file] --> [database]