in reply to SSHing in multiple servers and execute command on each

Hello sabas,

I had a similar case some time ago and I created multiple scenarios and solutions to my problem. My way of approaching your problem would be:

Net::OpenSSH::Parallel already Anonymous Monk proposed it. Alternatively you can create a foreach loop to connect to all nodes one by one. I would not use password authentication if I was you I would use ssh key authentication (more secure). The approach of looping one by one to the nodes I do not recommend it as it can result in time consuming and also if one node for some reason can not be reached can block the rest of the queue.

Sample of code for Net::OpenSSH::Parallel can be found here Re: multiple machines disk space alert. Sample of code using foreach loop and Net::OpenSSH can be found here Re: Simple SSH based chat client.

Hope this helps. BR / Thanos

Seeking for Perl wisdom...on the process of learning...not there...yet!