LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices



Reply
 
Search this Thread
Old 11-21-2005, 12:36 PM   #1
beeblequix
Member
 
Registered: Oct 2005
Location: Tierra Firma, Earth
Distribution: Debian of course...
Posts: 196

Rep: Reputation: 30
how to tell exactly when a process went defunct


I have a worker process that dies sometimes. The parent (when it works right) will respawn another child process. Doing a 'ps -ef' type command will then tell me when the new worker spawned, and this way I've been able to track down the death of the now defunct worker process.

But sometimes the parent can't respawn the worker. In these cases a "ps -ef|grep defunct| will give me a listing of the defunct processes, including the most recently dead one. That listing only tells me in minutes how much cpu time it used and the date it started. Is there any way to get more info out of it? I'd like to know exactly when (hour/minute/second date) it died. Ideas? thx.

I also have a number of logs that kick out. It's a bear to open them one by one (less) to search for errors. What's a good way to take that info and pass it through a program like awk or grep or something to search for just certain key words?


Last edited by beeblequix; 11-21-2005 at 12:39 PM.
 
Old 11-22-2005, 12:49 AM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian Squeeze
Posts: 5,805

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
Perhaps a bash script to look at several files and print the result to one file?

#!/bin/bash
cd /var/log
cat <log file name> | awk '/<search word>/ {print $0 }' <log file name> | tee logs.txt
cat <log file name> | awk '/<search word>/ {print $0 }' <log file name> | tee >> logs.txt
cat <log file name> | awk '/<search word>/ {print $0 }' <log file name> | tee >> logs.txt

where {print $0} gives the filename; <search word> is the word to search for; <log file name> is the name of the log to search; and tee sends the result to a text file for reading. Just keep adding log filenames, with appropriate 'cd' commands to change directory when necessary.

The first tee command initiates the file, the subsequent >> commands append to that file.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to kill a defunct process guarriman Linux - Software 4 05-15-2009 12:09 PM
<defunct>ed process bratch Linux - Software 5 04-28-2005 05:55 PM
[cp <defunct>] teeno Linux - Software 2 02-23-2005 05:47 AM
defunct linuxprogrammer Linux - Newbie 1 07-23-2004 01:07 PM
SYSLOG-NG <defunct> process icw_sec Linux - Software 0 04-26-2004 06:21 PM


All times are GMT -5. The time now is 04:23 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration