Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So here is what i want to do. I have a perlScript.pl and a list of machines: machineA,machineB,machineC. These are linux machines that i can ssh into. I want to issue this script on all 3 of these machines at the same time. I am trying to do some load analysis and need to measure the time it takes for the scripts to execute.

Any tips?

share|improve this question
    
One thing to consider is how closely in time the scripts need to run. If you can be off by a second or two, then even three ssh user@host command could do you. If you need millisecond timing, you need to use something to sync the clocks. –  pcapademic Jan 19 '10 at 23:11

6 Answers 6

pssh is a lot like dssh

You get these..

/usr/bin/parallel-slurp
/usr/bin/parallel-ssh
/usr/bin/parallel-scp
/usr/bin/parallel-rsync
/usr/bin/parallel-nuke

Both pssh and dssh won't start your jobs at /EXACTLY/ the same time. The other posters info about at will help you synchronize if you're worried about sub-second variation.

However, I bet your measurements are for longer running jobs that won't mind the slight interval it takes to fork new ssh connections to each host.

Good luck.

share|improve this answer

I think people are over-complicating this question.

three machines? Just ssh into each of them and run

time ./perlScript.pl

If you have 20,50,100 machines, then sure, use dsh,pssh,cluster-ssh/terminator/whatever.. but 3? just copy the command, open 3 windows, and hit paste 3 times.

I doubt the load analysis needs the commands to be started within milliseconds of each other, what is more useful is timing the actual execution.

share|improve this answer

Set up NTP so all three boxes are synchronized to a common source.

Then use the at command to run your script (here's a tutorial)

share|improve this answer
    
I would use at instead of cron, since the OP probably only wants to trigger the scripts on demand rather than periodically. –  Dennis Williamson Jan 19 '10 at 6:21
    
+1 for skipping the ssh part. (If checking for ssh connectivity is not part of the task.) –  Marie Fischer Jan 20 '10 at 19:41

Has anyone heard about puppet?? iff all the client are open system then puppet will help you a lot. Look at redectivelab website for details.

With that tool you can manage actually hell lot of things. We use it to maintain plethora of servers for the same kind of configuration.

Cheers!

share|improve this answer
    
This sort of thing is not really what puppet is used for. –  Justin Jan 20 '10 at 3:34
    
yup, as Justin pointed out puppet would be a overkill for this sort of minimal task. Thanks justin –  unixbhaskar Jan 24 '10 at 17:48

I recommend dsh (distributed shell).

share|improve this answer

you cand find different ssh clients on the net which connect to multiple clients at the same time, so you can execute commands at the same time. one of these clients is cluster ssh. you could give it a try or search for an other client on the net.

share|improve this answer

Your Answer

 
discard

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.