Simon says…Restart Your Daemons

April 14, 2010

in sysadmin

I’m all for performing service management using mechanisms built-in to a configuration management system (i.e. you change a config file and the config management system automatically restarts the daemon), but occasionally you get into a situation where you want to interactively do the same exact thing on several machines.

For example, I recently wanted to bounce the ClamAV daemon running on four of my incoming mail servers simultaneously. This process would require the exact same commands on all four machines, ideally run at the same time.

Rather than type the same thing four times, let me tell you about a few programs that can help in this sort of situation where you need interactive input to multiplex to different sessions. The one I used for the last example was OSX specific (since most of my time is spent typing at a Mac laptop):

  • iTerm – iTerm is a spiffy rewrite of the native OSX Terminal application that has a bunch of cool features. The one I used is called “Send Input to all Tabs” (under the Shell menu). iTerm lets you run multiple sessions in different tabs of the same window. When you turn “Send Input to all Tabs” anything you type in one tab is automatically echoed to every other tab. I ssh’d to each of the mail servers, turned on this feature, and typed the commands I needed a single time, yet all four machines obeyed these commands. If you run OSX and you haven’t played with iTerm, you really should.

Before I discovered this feature in iTerm, I used to use cssh, from ClusterSSH. It opens up a smaller input window and as many other xterms as you need. Anything typed in the input window is echoed to those windows. This program isn’t OSX specific, it can be used any place you can build the right Perl modules. I stopped using it a while back because I had issues with it building under MacPorts (if I built the modules it needed using the Apple-provided Perl libraries, everything was peachy, but building it into MacPorts in an attempt to avoid polluting the OSX install of Perl lead to a script that would segfault upon running).

I recently noticed a new rewrite of the same idea for OSX called csshx. It uses the native OSX terminal vs. X11. I haven’t tried it, but it looks promising. I suspect there are other utilities like this available. I wouldn’t be surprised if there was a way to do this with GNU Screen or tmux. Are there any you use for this sort if interactive multiplexing that I’m missing?

Be Sociable, Share!

Leave a Comment

Previous post:

Next post: