Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

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 Comments1 Solution584 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 “remote_file.sh” & 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
test.sh
ASKER CERTIFIED SOLUTION
Avatar of ahoffmann
ahoffmannFlag of Germany image

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

Commented:
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers