MySQL Forums
Forum List  »  MySQL Administrator

How to catch mysqldump errors in scripted dump?
Posted by: Mike Lott
Date: July 31, 2009 08:32AM

Hi

Just a quick question. Is it possible to catch errors with mysqldump and redirect them to a file for processing? I have the following code section that I am using as part of automated dumps of the databases of a MySQL instance:

<snip>
pushd ${DUMP_DIR}
# Iterate through relevant databases and dump.
# First remove "Database" heading and "information_schema" database.
for i in $(mysql -e "show databases" -uroot|sed "/^Database$\|^information\_schema$/d")
do
mysqldump --opt --force ${i}>$(date +%Y%m%d)_${i}.sql
# compress with bzip
/usr/bin/bzip2 $(date +%Y%m%d)_${i}.sql
done
popd
</snip>

Obviously with the --force flag I want to keep the process running but need to be made aware of any errors that occur.

Thanks,

Mike

Options: ReplyQuote


Subject
Written By
Posted
How to catch mysqldump errors in scripted dump?
July 31, 2009 08:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.