LinuxQuestions.org
Review your favorite Linux distribution.
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, 11:36 AM   #1
beeblequix
Member
 
Registered: Oct 2005
Location: Tierra Firma, Earth
Distribution: Debian of course...
Posts: 198

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 11:39 AM.
 
Old 11-21-2005, 11:49 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,908

Rep: Reputation: 356Reputation: 356Reputation: 356Reputation: 356
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 11:09 AM
<defunct>ed process bratch Linux - Software 5 04-28-2005 04:55 PM
[cp <defunct>] teeno Linux - Software 2 02-23-2005 04:47 AM
defunct linuxprogrammer Linux - Newbie 1 07-23-2004 12:07 PM
SYSLOG-NG <defunct> process icw_sec Linux - Software 0 04-26-2004 05:21 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 03:11 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
Open Source Consulting | Domain Registration