ps -ef |grep 24 hours


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ps -ef |grep 24 hours
# 8  
Old 11-01-2011
Quote:
Originally Posted by in2nix4life
From the 'ps' command man page:

If the process was started less than 24 hours ago, the output format is "HH:MM", else it is "mmm dd" (where mmm is the three letters of the month).

So grepping for that month and date combination should work:

ps -ef | grep '[A-Z][a-z][a-z][0-9][0-9]'

Hope this helps.
If its past a year, then it would display the year instead.

--ahamed
This User Gave Thanks to ahamed101 For This Post:
# 9  
Old 11-01-2011
awk works very well for me.

On top of the awk syntax, I need to pull out the PIDs with "kill -9 PID" command.
I will manually execute "kill -9 PID" when needed.

Please advise how to add the below to the awk syntax.
PHP Code:
|awk '{print "kill -9 "$2}' 
# 10  
Old 11-01-2011
Code:
ps -ef | awk '$5 ~ /[[:alpha:]]+/ {print "kill -9 "$2}'

or
Code:
ps -ef | awk '{if(!match($5,"(..):(..)")){print "kill -9 "$2}}'

etc.

(Although they won't actually kill anything. Which is probably a good thing!)
This User Gave Thanks to CarloM For This Post:
# 11  
Old 11-01-2011
That works great! Thank you so much.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inconsistent `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`

i have this line of code that looks for the same file if it is currently running and returns the count. `ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l` basically it is assigned to a variable ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Discussion started by: wtolentino
6 Replies

2. Shell Programming and Scripting

Get the no of hours between days

Hi, i have a date 1- 2013101511 date2 -2013101812 need toget the no of hours between them,can any one tellme the logic. (6 Replies)
Discussion started by: sandeep karna
6 Replies

3. Shell Programming and Scripting

Need help looking for missing hours.

I have a file that should cover a days worth of stats, at the beginning of each 15 minute report I have a unique header that looks like the below example. The "0000" and "0015" will change in the header line to show which 15 Minute interval the report is covering and of course from day to day the... (7 Replies)
Discussion started by: fsanchez
7 Replies

4. AIX

cron off by 5 hours

stupid question im sure, but its frustrating My cron jobs are off by 5 hours. My system time is right but all of my cron jobs are running approximately 5 hours late. Any idea why? (4 Replies)
Discussion started by: mshilling
4 Replies

5. Shell Programming and Scripting

CurrentTime-4 hours

Hi, Good Afternoon! I am writing this script on "sh" and have Variables as below. #Time in hours ex: 09 JobTime=`echo $StartTime |awk '{print $2}'|cut -f1 -d':'` SystemHours=`date +%H` How can go 4 hours back for each variable in a day? Another Question? JobStat=`dsjob -report... (5 Replies)
Discussion started by: rajubollas
5 Replies

6. Homework & Coursework Questions

list of files modified 10 hours ago using grep

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Here is the question: Make a list of files in your home directory that were changed less that 10 hours ago,... (3 Replies)
Discussion started by: fight4love
3 Replies

7. What is on Your Mind?

How Many hours on Computer?

How many hours you spend on Computer in a day??? (10 Replies)
Discussion started by: malcomex999
10 Replies

8. Shell Programming and Scripting

how to list files between last 6 hours to 3 hours

Hi Frens, I want to list some files from a directory, which contains "DONE" in their name, i am receiving files every minute. In this i want to list all the files which are newer than 6 hours but older than 3 hours, of current time i dont want my list to contain the latest files which are ... (4 Replies)
Discussion started by: Prat007
4 Replies

9. Post Here to Contact Site Administrators and Moderators

Have we just had a rollback of a few hours?

Have we just had a rollback of a few hours? (1 Reply)
Discussion started by: porter
1 Replies

10. UNIX for Dummies Questions & Answers

delete files that are over 2 hours old

guys, I have a need for a script that will delete all files in a given directory that are over 2 hours old. I will set this up to run in cron. I'm having a little trouble coming up with the syntax that will identify these files. Is there a variation of the ls command that I can use to identify... (3 Replies)
Discussion started by: hedrict
3 Replies
Login or Register to Ask a Question