troubleshooting Question

ssh executions on list of remote servers on linux and check status of executions

Avatar of enthuguy
enthuguyFlag for Australia asked on
LinuxShell Scripting
6 Comments2 Solutions584 ViewsLast Modified:
HI, can someone help with this
I would like to have a logic in shell script something like below. Could you provide a sample script

1.      Will read a comma separated string which contains remote server list server1, server2, server3,server4. (store it in a variable)
2.      Need to execute a shell script on remote server in async (sort of fire and forget). Remote script execution might take 15 minutes to complete. (So guess need FOR loop with execute  SSH user@servern “” & in background mode?)
3.      Capture the PID to a variable for each remote execution.
4.      Check the status of each PID in frequent internal. ( 10 seconds wait and then re-check)
5.      Whichever server/PID finishes, I shouldn’t check the status again for this PID (optional)
6.      Wait for a total of 20 minutes or 10 iterations, then exist from this check
7.      And report success or failure status.

What I’m trying to achieve is, to minimize the total task execution time

So far I’ve tried like this. But I’m sure there is better way to handle it very

thanks in advance

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros