http://www.politiker-stopp.de/gfx/politiker-stopp-print.png

Benjamin Schieder

[TECH] VERIFYING MYSQLDUMP OUTPUT THE QUICK-N-DIRTY WAY

2009 March 31 | 0 comments

Inspired by a recent blog post over at LGP I wrote this little bash function to verify if a mysqldump command has written the correct data to the filesystem:

blindcoder@fortuna:~$ type mysqldump
mysqldump is a function
mysqldump ()
{
filename="`readlink /proc/${$}/fd/1`";
exec > "`readlink /proc/${$}/fd/0`";
executable="";
for path in ${PATH//:/ };
do
[ -x "${path}/mysqldump" ] && executable="${path}/mysqldump";
done;
"${executable}" "${@}" | tee "${filename}" | md5sum;
md5sum "${filename}"
}
blindcoder@fortuna:~$ mysqldump -u root -p blindcoder_gurps > /tmp/gurps.sql
Enter password:
47726f328affa7a8a2f1db8a172b8c70 -
47726f328affa7a8a2f1db8a172b8c70 /tmp/gurps.sql


EOF

Category: blog

Tags: Tech mysql


Post a comment

All comments are held for moderation; basic HTML formatting is accepted.

Name: (required)
E-mail: (required, not published)
Website: (optional)
Comment: