Exforsys

Online Training

Want to Kill the Process

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 ...


Go Back   Exforsys > Operating Systems > Shell Programming

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-18-2007, 03:08 PM
Senior Member
 
Join Date: Apr 2006
Posts: 139
Ralph is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-19-2007, 03:36 PM
Senior Member
 
Join Date: Apr 2006
Posts: 122
rachelle is on a distinguished road
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
Guidelines for Process Rahulbatra SQL Server 1 05-16-2007 03: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 04:05 PM
Comp.software-eng FAQ (Part 0): periodic postings and archives David Alex Lamb Tech FAQ 2 05-23-2004 05:15 AM
Quarterly ASCII posting of Caldera (SCO) OpenUNIX 8 FAQ Boyd Lynn Gerber Tech FAQ 0 04-25-2004 10:11 PM
Comp.software-eng FAQ (Part 0): periodic postings and archives David Alex Lamb Tech FAQ 3 04-18-2004 05:15 AM


All times are GMT -4. The time now is 06:49 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.