Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2007 10:35:31 -0500
From:      Eric Crist <mnslinky@gmail.com>
To:        Questions User <freebsd-questions@freebsd.org>
Subject:   mysqldump/gzip shell scripting question...
Message-ID:  <1A4196AD-1749-40BC-8F41-3F4E4715096C@gmail.com>

next in thread | raw e-mail | index | archive | help
Hey all,

First off, I don't care if you send example in perl, php, or sh, but  
we're not a python shop here, so those recommendation will not be  
useful...

I'm trying to write a shell script that scans our databases for  
tables starting with archive_ which are created by other scripts/ 
departments, etc.  This script needs to perform a mysqldump of that  
table, and then gzip it.  It's MUCH quick to pipe directly to gzip,  
than perform the dump, then gzip that.  The problem is, this table to  
filesystem dump is also going to drop those archive_* tables.  We  
would like to know that the mysqldump worked before we do this.  The  
problem we're having, as I'm sure others have run into (at least  
according to Google), is that a command such as the following leaves  
no apparent easy way to capture the exit status of the mysqldump  
command:

# mysqldump -u $USER -p$PASS $DBHOST $DATABASE $TABLE | gzip >  
$TABLE.sql.gz

Anyone have any good recommendations?

Thanks!

Eric Crist



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1A4196AD-1749-40BC-8F41-3F4E4715096C>