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.
Asked
Active
Viewed 963 times
0
-
See parallel-ssh: https://code.google.com/p/parallel-ssh/ – Barmar Jan 31 '15 at 14:34
1 Answers
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.)

John
- 17,011
-
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 04 '15 at 15:59