Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've server Master,SlaveA,SlaveB,SlaveC, and want to get eg. the space information from the server by executing one bash script on the master.

How can I do that?

--case-- - Master - A - B - C

Get df on slaves.

--ex. output---
==Slave A==
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             7222500   3909896   2945720  58% /
==Slave B==
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             4222500   3909896   5744447  98% /
==Slave C==
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda1             1222500   509896   xxxxxxxx  50% /

Many Thanks! DeLol

share|improve this question
You should consider using tools like Nagios and Munin for this sort of thing rather than running scripts manually. – ThatGraemeGuy Apr 10 '13 at 13:39
@ThatGraemeGuy: Nagios etc. is fine, but it doesn't tell you more than that everything is OK. Sometimes I just want to have a list of data from several servers, or do something on all of them. And no, Puppet etc. isn't always the answer. – Sven Apr 10 '13 at 13:42
I'm not sure what Puppet has to do with this, since that's used for configuration management. Nobody even mentioned it. – ThatGraemeGuy Apr 10 '13 at 13:48
@ThatGraemeGuy: It was just a proactive statement from my side, not necessarily aimed to you directly, but tools like puppet are usually the next thing mentioned in discussions like that. "You want to do things on many machines. Use puppet/chef/cfengine". – Sven Apr 10 '13 at 14:06
dsh can handle this for any arbitrary command. – Mike Renfro Apr 11 '13 at 2:45

For a limited list of clients I have a bash function in my ~/.profile:

ch () {

   echo host1
   ssh root@host1 $@
   echo host2
   ssh root@host2 $@

I call this like this:

ch df

This can be easily expanded to a list of clients read from an array or a config file.

Another option is to use something like cssh or similar.

share|improve this answer

Put the commands you need in a quick script on the master and run the script like this:

ssh <

This executes the commands contained within on the remote host without copying script to the remote system.

Also see: Documenting server details

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.