Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-03-2012, 05:57 PM   #1
LQ Newbie
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
How to run Multiple sequential background tasks?

Dear All,

My apologies if there exists in another topic and I did not find it; there was no obvious name for my problem.

I would like to run a script that runs some commands, such as the following

"A1->A2->A3" simultaneously with "B1->B2->B3"

If A2 did not depend on A1, and A3 did not depend on A2, etc I could simply do something like this:

./A1 & ./A2 & ./A3 &

But this starts all the jobs at once. I need A2 to not run until A1 is done, and A3 for A2, etc.

hence: ./A1; ./A2; ./A3;

But I want the A jobs to run simultaneously with the B jobs, where B2 depends on B1, and B3 depends on B2.

I've tried things like:

"./A1; ./A2; ./A3;" & "./B1; ./B2; ./B3;" &

But this generates script errors.

Now, I can obviously do this a number of uglier ways - making scripts that contain just the A's or just the B's and running those scripts in the background, or running system calls inside a python script that oversees operations, etc. But I am trying to do this in a more elegant way, and I am hoping that the shell scripting language was rich enough to express this.

Does anyone know how this can be done? (e.g. write this all into one script)

Thanks very much, unix gurus!

Last edited by Minotaar; 01-03-2012 at 06:06 PM. Reason: Solved the problem
Old 01-03-2012, 06:05 PM   #2
LQ Newbie
Registered: Jan 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
nevermind! I just discovered subshells. Just had to try some different google search terms to get the right answer!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I do other tasks in the background, and transfer files with a progress bar? Syllinger Linux - Newbie 15 01-21-2012 04:37 AM
[SOLVED] if statement with multiple tasks ted_chou12 Linux - Newbie 3 02-02-2011 06:59 PM
semaphore with multiple tasks Rama Anandakrishnan Linux - Kernel 3 08-01-2007 06:48 PM
Run once tasks Elguapo Linux - Software 6 07-11-2007 05:20 PM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:45 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration