Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am running some programs over a cluster and I would like to run them in a sequence, i.e when the first program terminates the second one starts and so on. This is so that my cluster does not exceed its bandwidth and its memory pool. Crontab is not what I am looking for because I do not know when the program finishes. Is there a way I can run my programs in this manner?

share|improve this question
3  
How do you start your programs? E.g. on a non cluster you could do program1 ; program2 ; program3 to start three programs sequantially, or program1 && program2 to start program 2 after program1 has succesfully ended. ( && for success, || for failure). –  Hennes Jan 6 '13 at 14:36
    
To add to @Hennes' response, one can use parentheses to group commands if the priorities are unhelpful - && is higher-priority than ||, which can be thought of as higher-priority than ;. –  Darael Jan 6 '13 at 19:08

1 Answer 1

You could execute remote commands via SSH, where one of the server run as the central script execution. You can use key-based authentication. Below is an example of a script file, the script are executed one by one,

ssh root@MachineA 'bash -s' < local_scriptA.sh
ssh root@MachineB 'bash -s' < local_scriptB.sh
ssh root@MachineC 'bash -s' < local_scriptC.sh
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.