The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
not able to kill find with kill -9 Amardeep UNIX for Dummies Questions & Answers 5 01-04-2007 02:49 PM
KILL PID, intern should kill another PID. rkrgarlapati Shell Programming and Scripting 4 10-17-2006 04:47 AM
how to generate a random list from a given list mskcc Shell Programming and Scripting 3 05-30-2006 12:30 AM
When kill doesnt work, how to kill a process ? VijayHegde UNIX for Advanced & Expert Users 3 05-12-2006 01:24 PM
how to generate a list of files jasongr Shell Programming and Scripting 3 12-13-2005 05:15 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 05-02-2008
Registered User
 

Join Date: Oct 2007
Posts: 29
Thanks Era.
Reply With Quote
Forum Sponsor
  #9  
Old 05-14-2008
Registered User
 

Join Date: Oct 2007
Posts: 29
Hi Era,

I have the list produced by :

ps -ef -o "user pid ppid cpu etime tty time args"

and the output looks like:

oracle 1626616 1 0 37-05:24:09 - 00:06:29 oracleDEV (LOCAL=NO)
oracle 1638908 1 0 37-05:24:09 - 00:06:24 oracleDEV (LOCAL=NO)
oracle 1642760 1 0 37-05:24:08 - 00:06:23 oracleDEV (LOCAL=NO)
oracle 1651012 1 0 26-01:15:11 - 00:02:07 oracleDEV (LOCAL=NO)
oracle 1655052 1 0 37-05:24:08 - 00:06:22 oracleDEV (LOCAL=NO)
oracle 1659266 1 4 01:14:16 - 00:01:49 oracleDEV (LOCAL=NO)
oracle 1712408 1 0 36-04:08:24 - 00:06:26 oracleDEV (LOCAL=NO)
oracle 1720698 1 0 05:27 - 00:00:00 oracleDEV (LOCAL=NO)
oracle 1728950 1 0 14-06:37:31 - 00:02:33 oracleDEV (LOCAL=NO)
oracle 1732902 1 0 01:52:11 - 00:00:01 oracleDEV (LOCAL=NO)
oracle 1737166 1 0 08:32:27 - 00:00:10 oracleDEV (LOCAL=NO)
oracle 1745166 1 0 08:57:59 - 00:00:18 oracleDEV (LOCAL=NO)
oracle 1753436 1 0 01:24:40 - 00:00:01 oracleDEV (LOCAL=NO)
oracle 1765692 1 0 01:28:10 - 00:00:01 oracleDEV (LOCAL=NO)

The 3rd column is the elapsed time and in Format of [[ dd-]hh:]mm:ss, is it possible I only want it to return the PIDs for processes elapsed longer than 8 hours?

if I issue :
ps -ef -o "user pid ppid cpu etime tty time args" | awk '$8 ~ /(^|\/)[f]60/ && $3>1 { print $2 }'

it returns all the PIDs regardless of elapsed time, can you please advise how to modify the script and let it return only processes elapsed longer than 8 hours?


Many thanks!
Victor Cheung
Reply With Quote
  #10  
Old 05-14-2008
era era is offline
Herder of Useless Cats
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,650
It prints nothing at all for me, the processes are not called f60 and $3 is not greater than 1.

But to focus on the elapsed time, you could say $5 ~ /[0-9]-/ for anything with more than one day (trivially more than 8h then) and for the remaining ones, split($5, t, /:/) and print if t[1] > 8.
Reply With Quote
  #11  
Old 05-14-2008
Registered User
 

Join Date: Oct 2007
Posts: 29
Thanks Era!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 09:07 AM.


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

Content Relevant URLs by vBSEO 3.2.0