0

This question already has an answer here:

I need a script that can SSH to multiple servers and execute a find command to check when was the last time a file was created.

marked as duplicate by Gilles ssh Jan 31 '15 at 23:16

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

If you need it run at the exact same time on all servers, you'll need some form of multi-programming environment. Many languages like Python and Ruby have solutions for that. If you can handle a rapid-fire one-at-a-time thing, just enclose the ssh command in a for loop:

for server in <list>
do
  ssh $server find ...
done

(Note: this loop format works fine for me, but you may need some tweaking depending on your shell.)

  • I don't need to run the command at the exact same time. I created the scrip based on tour example but I'm getting this error message: Could not resolve hostname PATH: Name or service now known – Youssef Karami Feb 4 '15 at 15:59

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