How to send input to many terminalsTue, Oct 16, 2012 in Databases Open Source Operations
Do you ever find yourself wanting to open several terminal windows and send the same commands to all of them? I’ve had this need many times, and I’ve never found a completely satisfactory solution. I’ve also known a lot of people who’ve written various sets of scripts to help them accomplish such tasks.
In no particular order, here are a few ways I’ve done this in the past:
- Facebook’s pmysql client
- The dsh tool
- Several screen windows named remoteXXX, followed by a bash for-loop:
while read cmd; do screen -X at remote# stuff "$cmd"; done
- Using many PuTTY windows and the puttycs tool
- Opening many tabs in KDE’s Kterm tool and selecting the options to send input to all tabs
Here are some I’ve heard about, but never used:
Of course, in many cases a technology like Chef or Puppet provides the true solution. But a lot of the MySQL users I’ve known haven’t grown to the point that they want to spend the upfront time and effort to learn and deploy something like that. They’re investing in development instead, and bearing the cost of a little less efficient systems administration process.
What’s your favorite technique for doing lots of things all at once?
I'm Baron Schwartz, the founder and CEO of VividCortex. I am the author of High Performance MySQL and lots of open-source software for performance analysis, monitoring, and system administration. I contribute to various database communities such as Oracle, PostgreSQL, Redis and MongoDB. More about me.