tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: determine age of (child)processes?
@ 2001-02-02  9:35 Alex Harkema
  0 siblings, 0 replies; only message in thread
From: Alex Harkema @ 2001-02-02  9:35 UTC (permalink / raw)
  To: tru64-unix-managers

The solution seems to be using the -o switch on the ps command, specifying
the `lstart` option:

/bin/ps -e -o pid,ppid,lstart

Gavin Kreuiter correctly stated that I'll still need a complicated date/time
handling method... using this option in a 'seek-and-destroy' script.

Thanks to all who responded.

Alex

=== ORIGINAL POST: ===

> Hello managers,
> 
> I'm wondering if there is any way to determine the age of processes.
> 'ps' gives not exactly the output I need. If a process is over 24 hrs old,
> the starting DATE is printed in the STARTTIME field.
> 
> In the processtabel, I have 3 childs with the same parent (the same PPID)
> Sometimes the parent creates more childs (this is not the problem) but the
> parent sometimes forgets to tell the oldest childs they may go. 
> So after a day or 3 I find 10-15 childs from the same parent, while 3 is
> enough.
> With those few lines I'm able to determine the correct id of the parent; I
> also know the cilds' id's.
> But how to kill the oldest child?? Is the first one named in the
> processtabel ALWAYS the oldest one?
> 
> ps axj|grep $PROC | while read line
> do
> echo $line|awk '{print $2}' >> /tmp/.$PROC.pid
> echo $line|awk '{print $3}' >> /tmp/.$PROC.ppid
> done
> 
> for a in `cat /tmp/.$PROC.pid
> do
> grep -q $a /tmp/.$PROC.ppid && echo "Id of parent process for $PROC is:
> $a"
> done
> 
> (relevant) output `ps axj|grep $PROC:`
> usr		pid	ppid	proc
> nopdux    6054  25564  	FNLBX	
> nopdux   25564  19592   FNLBX
> nopdux   25888  25564   FNLBX
> nopdux   28964  25564   FNLBX
> 
> 
> Any ideas/hints?
> Tnx. i.a
> Alex Harkema

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-02  9:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-02  9:35 SUMMARY: determine age of (child)processes? Alex Harkema

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox