This is a discussion on Want to Kill the Process within the Shell Programming forums, part of the Operating Systems category; My shell script has a main program that runs as a main parent. There are many scripts called from this ...
|
|||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Want to Kill the Process
My shell script has a main program that runs as a main parent. There are many scripts called from this main parent process. Each of these child process returns to the parent after execution. But I want to kill the child process before it returns to the main parent program. I am struck with this step. Someone provide me suggestions for doing this.
|
|
|||
|
Each process has a process id associated with it. It is this process id which will help us in deleting the process or accessing the process a user requires. For your requirement first you must get the process id of the last background process. This can be got by using the command $!.The command returns the process id of the last background process. Also get the process id of the current process in execution using the command $$. Now to kill the child process after its execution and return to your main process use the command kill -1 followed by the process id of the last background process stored in $!. Give this in the main process and your last child process would get killed.
|
![]() |
| Thread Tools | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Guidelines for Process | Rahulbatra | SQL Server | 1 | 05-16-2007 04:38 PM |
| HP, Blr for Process Associate - B.Com. or B.Sc. or BBM- 2002,2003,2004 and 2005 Batch | techguru | Freshers Jobs | 0 | 07-22-2005 05:05 PM |
| Comp.software-eng FAQ (Part 0): periodic postings and archives | David Alex Lamb | Tech FAQ | 2 | 05-23-2004 06:15 AM |
| Quarterly ASCII posting of Caldera (SCO) OpenUNIX 8 FAQ | Boyd Lynn Gerber | Tech FAQ | 0 | 04-25-2004 11:11 PM |
| Comp.software-eng FAQ (Part 0): periodic postings and archives | David Alex Lamb | Tech FAQ | 3 | 04-18-2004 06:15 AM |