[SOLVED] How to run Multiple sequential background tasks?
Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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