Created
August 18, 2010 19:35
-
-
Save iangreenleaf/535897 to your computer and use it in GitHub Desktop.
MySQL import with file names and progress bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage: reload-db /path/to/sqldump dbname | |
function reload-db { | |
for f in "$1"/*.sql; do | |
printf "%-${COLUMNS}s" "$f">&2; | |
cat "$f"; | |
done \ | |
| pv -s `du -sb "$1" | awk '{print $1}'` \ | |
| mysql -uroot "$2"; | |
if [ $? != 0 ]; then echo 'ERRORS!!!!!!!!!!!!!'; return $?; fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment