MySQL Dump/Restore With Progress Indicator
Today I just found out about a great utility called
bar. bar shows a progress indicator on the command line.
Bar can be installed via homebrew on os x:
brew install bar
I don’t know the exact syntax for the command, I only have my working examples to show… The help message isn’t too helpful and I don’t seem to have any man pages available.
Here’s a sample of what it looks like:
#!/bin/bash #where local_db and remote_db are strings with mysql args and tmpfile is created via mktemp echo 'Dumping database...' mysqldump $local_db | bar > $tmpfile echo 'Restoring database to production...' bar $tmpfile | mysql $remote_db
And the output looks like this:
Dumping database... 100% [==============================================================] Restoring database to production... 100% [==============================================================]
There also another tool called
pv which stands for pipe viewer I’m currently trying to work out how to use that tool so I can use it instead. It seems to be more common, documented and feature-rich.
blog comments powered by Disqus