Misc changes to improve error output

This commit is contained in:
Paul Reeves 2023-01-26 15:57:53 +01:00
parent caaa1ffee8
commit ec81b04b6e
1 changed files with 16 additions and 7 deletions

View File

@ -439,7 +439,7 @@ if [ -f $DBFILENAME ]; then
echo "" >> recreate_db.ddl
fi
#echo "create database 'localhost:$ALIAS';" >> recreate_db.ddl
echo "create database '$ALIAS';" >> recreate_db.ddl
echo "create database '$ALIAS' SET NAMES 'UTF8';" >> recreate_db.ddl
echo "commit;" >> recreate_db.ddl
#echo "connect '$ALIAS';" >> recreate_db.ddl
@ -450,13 +450,14 @@ echo "commit;" >> recreate_db.ddl
#run creation script
if [ -f $ALIAS.sql ]; then
echo Running $ALIAS.sql...
${FIREBIRD_BIN}/isql -b -user FWFRAMEWORK_OWNER -pass masterkey -role RDB$ADMIN -e -i $ALIAS.sql -o $ALIAS.txt -m -m2 > /dev/null
${FIREBIRD_BIN}/isql -b -user DB_OWNER -pass masterkey -role RDB$ADMIN -e -i $ALIAS.sql -o $ALIAS.txt -m -m2 > /dev/null
else
echo Could not find $ALIAS.sql.
echo Exiting.
exit;
fi
# This should be part of recreate_db.ddl
if [ $(whoami) = "root" ]; then
chown firebird.firebird $DBFILENAME
chmod 660 $DBFILENAME
@ -464,9 +465,13 @@ fi
#print errors
echo Checking for Errors
cat $ALIAS.txt | grep -B 16 -A 16 "Statement failed"
if [ $? -gt 0 ]; then
echo
echo Checking for Errors...
echo
echo
#cat $ALIAS.txt | grep -B 16 -A 16 "Statement failed"
_err_count=$(cat $ALIAS.txt | grep -c "Statement failed")
if [ $_err_count -eq 0 ]; then
echo No errors found.
echo Script completed successfully.
echo
@ -474,9 +479,13 @@ if [ $? -gt 0 ]; then
echo
echo Here are the last lines from $ALIAS.txt
echo
tail -n 20 $ALIAS.txt
echo
tail -n 30 $ALIAS.txt
else
echo Script failed with the following errors:
cat $ALIAS.txt | grep -B 3 -A 4 "Statement failed"
fi
echo
echo
echo "$(date) Completed."
}