LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Continue Script Execution After Initiating a Program in a Client (https://www.linuxquestions.org/questions/linux-newbie-8/continue-script-execution-after-initiating-a-program-in-a-client-713859/)

senthilmuthiah 03-23-2009 02:05 PM

Continue Script Execution After Initiating a Program in a Client
 
All:

I am experimenting to run my simulations with two computers. Every time I run the script on the server, it first checks for the computers' availability (a computer is 'available' if its not executing any simulation currently) and then executes the simulation on that computer.

My script is organized the following way:
if(client is available)
then
ssh into client
run simulation
fi
if(server is available)
then
run simulation
fi

PROBLEM: If the client is available, I want linux to initiate the simulation in the client and then come back and continue executing the remaining of the script [My simulation takes atleast 4 hours to get done. If I am going to wait for that many hours for the control to return to the server, then there is no point in this experiment at all, right?! I want these simulations to run parallely! :) ]

If anybody could help me in getting the control back to the next line of the script (and hence to check server availability and initiate the simulation in the server), it would be awesome!

Thanks in advance!

JaksoDebr 03-23-2009 04:35 PM

In your script you need to add an '&' after the line that takes so long, something like:
./my-application some-params &

the ampersand will make that command run in the background, so the rest of the script will not wait for that line to finish.

Linux Archive

senthilmuthiah 03-23-2009 07:27 PM

Quote:

Originally Posted by JaksoDebr (Post 3485429)
In your script you need to add an '&' after the line that takes so long, something like:
./my-application some-params &

the ampersand will make that command run in the background, so the rest of the script will not wait for that line to finish.

Thanks JaksoDebr. I am afraid it isn't working. I tried using 'bg' too. I would greatly appreciate anyother ideas!

Thanks once again!

senthilmuthiah 03-25-2009 06:06 AM

Alright! I have now got how to do this.
I should execute the commands in the client through "ssh -f".


All times are GMT -5. The time now is 03:57 AM.