ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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.
I have an application (shell script) wherein my parent process spawns off many child processes. These will exit once they have completed their task.
After spawning the processes, parent spawns another process . This spawned process will be in an infinite loop wherein it keeps asking for an user input.
At the same time, I need the parent process to do a 'wait' till all the child processes(except the 'user input process' have exited. The 'user input process wont exit as it will run infinitely' . So, once the spawned processes have exited, the parent should kill the 'user input process' and the parent should exit
parent process starts
spawn child processes # Step 1
(user input process) & # Step 2
wait for the spawned processes in Step 1
Now the processes spawned in Step 1 have died
Kill the 'user input process' (Spawned in Step 2)
Now how do I make my parent wait for all its children, except for the user input process?
Wait for the specified process and return its termina-
tion status. n may be a process ID or a job specifica-
tion; if a job spec is given, all processes in that
job's pipeline are waited for. If n is not given, all
currently active child processes are waited for, and
the return status is zero. If n specifies a non-
existent process or job, the return status is 127.
Otherwise, the return status is the exit status of the
last process or job waited for.