Questions and Answers :
Unix/Linux :
Start multiple Linux clients from script
Message board moderation
Author | Message |
---|---|
ross Send message Joined: 26 Aug 03 Posts: 4 Credit: 4,593,158 RAC: 0 ![]() |
Hi I am a relative Linux newbie, and have several linux boxes to learn on. I want to stop and start the client on demand, and have been ssh'ing in to start them individually. I would like to start the program on all 5 boxes with a script. I have setup ssh to use keys rather than a password so the script logs in automatically without a password prompt, and tried a simple script: ssh <client1 IP> <command> ssh <client2 IP> <command> etc The problem is that the script starts up the first client but the first line doesn't complete so the 2nd client isn't started. I have been cheating by running the same script 5 times as after the error message client already running it moves onto the next line. I would like the script to open each client in a seperate terminal window so I can keep tabs on what the machines are up to. Any scripting advice would be welcome. Thanks Ross |
Dotsch ![]() Send message Joined: 9 Jun 99 Posts: 2422 Credit: 919,393 RAC: 0 ![]() |
You can start the ssh with the -f option, and all start the boinc client in the background. A short example, for the thing you would do. It starts command on client1 and client2 and logs the output to $LOGFILE ($LOGFILE is the path and filename where the outputs of <command> should be logged : #!/bin/sh ssh -f "<client1 IP> <command> > $LOGFILE 2>&1 " & ssh -f "<client1 IP> <command> > $LOGFILE 2>&1 " & |
©2025 University of California
SETI@home and Astropulse are funded by grants from the National Science Foundation, NASA, and donations from SETI@home volunteers. AstroPulse is funded in part by the NSF through grant AST-0307956.