LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-29-2008, 02:13 AM   #1
aarontwc
Member
 
Registered: Oct 2008
Posts: 66

Rep: Reputation: 15
Check if a program has been killed


How do I check if a program has been killed in PERL? I suspect I can do something like ps ax | grep 'program-name', loop through, use regular expression.

But I think this is like a hackish approach.

I am using something like system ("INT", procId) (in a fork), basically to send a signal to kill a process. The process will take about 2 minutes to kill. How will I know when the process is killed? What is the correct method? I understand a program normally returns an 'exit value' when it exits correctly. Can I possibly make use of this property?



Thanks
aaron
 
Old 11-29-2008, 01:30 PM   #2
aarontwc
Member
 
Registered: Oct 2008
Posts: 66

Original Poster
Rep: Reputation: 15
Oops, wrong title. Actually the question is, how do one know if the process has been killed? Do I really need to go down the road to checking the process table and stuff?

Thanks
aaron
 
Old 11-29-2008, 02:02 PM   #3
jcookeman
Member
 
Registered: Jul 2003
Location: London, UK
Distribution: FreeBSD, OpenSuse, Ubuntu, RHEL
Posts: 417

Rep: Reputation: 33
http://perldoc.perl.org/functions/waitpid.html
 
  


Reply



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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Program still running after being killed noma Linux - Newbie 1 07-07-2008 06:55 PM
program to autostart a killed service ~=gr3p=~ Linux - Networking 4 02-21-2006 12:04 AM
program is killed after exactly 30 minutes cdenizet Linux - Software 2 10-23-2005 03:04 AM
How to check which libraries does a program use? sceadu Programming 7 12-27-2004 07:39 PM
RBL Check Infinite-Monkeys timed out and was killed romel Red Hat 2 05-21-2004 11:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration