Need to list 3 days old processes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to list 3 days old processes
# 8  
Old 08-02-2010
Guys... all these command lines uses perl. I don't have updated perl in my machine. any alternatives.... ?

Last edited by Sriranga; 08-02-2010 at 03:39 PM..
# 9  
Old 08-02-2010
Quote:
Originally Posted by Sriranga
Dude.... its a client production server. I don't have access to install perl. is it not possible to do it without the help of Perl ?
Code:
#!/bin/ksh
x=0
for i in 24 48 72
 do
TZ=GMT+$i date|awk '{print ""$2 " "$3 ; }'|awk {'print $2'}|grep "[^0-9]" > /dev/null 2>&1
    if [ "$?" -eq "0" ]; then
dateone[x]=$(TZ=GMT+$i date|awk '{print ""$2 " "0$3 ; }')
    else
      dateone[x]=$(TZ=GMT+$i date|awk '{print ""$2 " "$3 ; }')
  fi
x=`expr $x + 1 `
done
echo "Listing Process...."
ps -eo pid,ppid,command,stime | grep -v grep | egrep "${dateone[0]}|${dateone[1]}|${dateone[2]}|[0-9]*:[0-9]*:[0-9]*"

Code:
 
Listing Process....
  5741  49038 /usr/sbin/sshd2  13:27:55
 48522  49038 /usr/sbin/sshd2  08:43:12
 81056 452821 sftp-server      16:29:56
196110      1 /usr/sbin/esmd     Jul 30
250383  49038 /usr/sbin/sshd2  10:12:40
263736  49038 /usr/sbin/sshd2  09:34:28
396770 479004 /usr/local/bin/g   Jul 31
464121 134209 sh -c /usr/users 17:45:00
464923 134209 sh -c /usr/local   Jul 31
479004 464923 [sh]               Jul 31
491157  49038 /usr/sbin/sshd2  15:20:21
125579   5741 -ksh (ksh)       13:28:00
435433 125579 [ksh]            13:28:00
 67394 406865 [ksh]            10:12:54
406865 250383 -ksh (ksh)       10:12:54
284319 377228 /usr/local/bin/d 09:34:53
364089 523652 bash             09:34:46
377228 364089 menu             09:34:53
107532 306563 ps -eo pid,ppid, 17:47:11
222920 463934 bash             15:20:41
234977 491157 -ksh (ksh)       15:20:27
463934 234977 -ksh (ksh)       15:20:30
467724  43034 bash             17:39:50
..................
..................

Regards
ygemici
# 10  
Old 08-02-2010
@ygemici
I repeat the "-o command" parameter is not valid in HP-UX "ps".


Also the "TZ" trick does not work in HP-UX beyond 24 hours increment. Even then it only works if the local timezone is GMT.
It is also wrong for GMT+24 during BST.

Last edited by methyl; 08-02-2010 at 01:47 PM..
# 11  
Old 08-02-2010
Quote:
Originally Posted by methyl
@ygemici
I repeat the "-o command" parameter is not valid in HP-UX "ps".


Also the "TZ" trick does not work in HP-UX beyond 24 hours increment. Even then it only works if the local timezone is GMT.
It is also wrong for GMT+24 during BST.
it can work if you set Unix95
i know like this ?
Code:
export Unix95=1

I know already TZ trick does not every system if localtimezone is not GMT..Already I said "can he try ?"

Maybe could write a specific script but i have not hp-ux system for now..


However any ideas for intended to solution?
# 12  
Old 08-03-2010
Thanks for your replies guys.... but actually TZ trick is not working on HP-UX ! am thinking...is my requirement that much dificult in HP-UX ?
# 13  
Old 08-03-2010
I think I am wrong ...it will be Jul 15 ...so we need know how to output the exact time

Last edited by skles; 08-03-2010 at 04:15 AM.. Reason: typo
# 14  
Old 08-03-2010
I think I am wrong ...it will be Jul 15 ...so we need know how to output the exact time

Last edited by skles; 08-03-2010 at 04:16 AM.. Reason: typo
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

List files older than 10 days.

Hello all, I want to list the files older than 10 days. Currently am using find ./ -mtime +10 -exec ls -ltr {} \; command. But I want to execute the same command in 16 directories at a time and want an output asking to remove those file? Please help me to design the script. regards, Ajay (3 Replies)
Discussion started by: 02Ajay
3 Replies

2. Shell Programming and Scripting

How can i list files above 5 days old?

HI how can i list files above 5 days old i want to keep only last 5 days application logs Regards, Ben (3 Replies)
Discussion started by: bentech4u
3 Replies

3. HP-UX

listing processes older than n days

Hello; trying to find processes older than n days, mostly user shells Tried the following code on 11.31 box: in this case older than 5 days UNIX95= ps -ef -o user,pid,ppid,cpu,etime,stime | grep "-" | awk '{print $2}' | xargs ps -ef|grep -v '?' |\ awk '$5 !~ ""' | awk '($5 ~ "$(date "+%b")")... (6 Replies)
Discussion started by: delphys
6 Replies

4. AIX

etime - get processes running for more than 30 days

In AIX I am trying to get the processes ran by user declan using the following format: ps -aef -o user,pid,etime,args | grep declan Then I get a result similar to (for example): declan 103264 123-12:47:33 /applications/apache/1.3.39.0/bin/httpd -d /var/applications/apache/www1 ... (0 Replies)
Discussion started by: chipahoys
0 Replies

5. Shell Programming and Scripting

List the files which are older than 7 days

Hi Frnds, I have to list the files which are older than 7 days in the given directory. it should consider only the files and should not show subdirectories. Thanks, Raja (3 Replies)
Discussion started by: smr_rashmy
3 Replies

6. Solaris

List of files last modified 30/60/90 days

Hi, I want to find the list of all the files under a directory (including it's subdirectories) last modified 30 days, 60 days, 90 days..also I want to find out the rate at which the disk space is growing. Please help. (3 Replies)
Discussion started by: b.paramanatti
3 Replies

7. Shell Programming and Scripting

Need to kill processes that are older than 3 days

Hi, I need a .ksh script that lists all the process that are currently running and older than 3 days. once the process list is available i need to mail the list and then kill those processes. Quick response is highly appreciated :b: Thanks in Advance!!! Sri (3 Replies)
Discussion started by: Sriranga
3 Replies

8. Programming

how to get list of processes

Hi, How can I get a list of all the running processes, in C? (13 Replies)
Discussion started by: yaron
13 Replies

9. Shell Programming and Scripting

List directory 7 days older

Say folder archive/ contains many folder each created on a day. this folder may contain files. i want to write a script to delete all the folder inside archive/ which are 7 days older. i used the below script for the reason. find archive -mtime +7 -type d -exec rm -r {} \; pls suggest me if... (3 Replies)
Discussion started by: krishnarao
3 Replies

10. UNIX for Dummies Questions & Answers

list last 10 days modified files

All, Is there is anyother single command that will handle ls -lrt | tail -10 Please let me know Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies
Login or Register to Ask a Question