The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Killing of a process and send a mail if the process doesnot come up within 2 minutes Prince89 Shell Programming and Scripting 1 02-15-2008 03:10 PM
Reg process of killing shanshine SUN Solaris 6 12-05-2007 10:50 AM
Killing specific process benefactr Shell Programming and Scripting 6 10-25-2007 09:23 AM
killing a process bbhayana UNIX for Dummies Questions & Answers 6 06-02-2007 04:58 AM
killing a process pid jo calamine UNIX for Advanced & Expert Users 16 12-04-2006 03:43 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-03-2008
Registered User
 

Join Date: May 2008
Posts: 7
Thumbs down killing the process

Hi,
First, I am running a scipt.While the script is running I realize that I dont want the script to be run so I am killing the script externally.Before the process gets terminated or killed it should delete all the temporary files created by the script.How to do this?Can anyone help me?


Thanks in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 06-03-2008
Registered User
 

Join Date: Sep 2007
Location: Koblenz, Germany
Posts: 576
Best you give the process a chance to do this and kill it with a "normal" kill or kill -15 (ie. SIGTERM) which is the same.
Do not use a kill -9, because it will be so hard, that it will have no chance to clean up anything. You might have IPCs left and such stuff. kill -9 should onl y be used, if it still lives on after you have sent a normal kill to it.
And if it's still there after a kill -9, you got a zombie and should reboot next time you get a chance to.
Reply With Quote
  #3 (permalink)  
Old 06-03-2008
vgersh99's Avatar
Moderator
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 2,999
catch the kill signal with 'trap' and remove temp files once the signal is caught.
'man trap'
Reply With Quote
  #4 (permalink)  
Old 06-03-2008
Registered User
 

Join Date: Sep 2007
Location: Koblenz, Germany
Posts: 576
Reading it again, forget my post and use vgersh99's
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0