Skip to content
Snippets Groups Projects
Commit 7a672431 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

mysql dump: update check for empty data

parent 32a41779
Branches
No related tags found
1 merge request!58mysql dump: update check for empty data
......@@ -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
......
......@@ -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]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment