02-03-2006
I don't understand how the process age fits into this problem. In general, no, it is hard to get the age of a process. The tools mostly display start time. So you need to do calculations. I believe that you use SunOS, though. Bear in mind that on a Sun, you can using the find command on processes by using /proc. Each process gets a subdirectory. So as root you can do:
cd /proc
find . ! -name . -prune -mtime +3 -print | xargs ls -ld
or something like that.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I want to know my file is 1 hr 30 min old or not,
If 1 hr 30 min old I will do some tasks in that file.. other wise I will wait to 1 hr 30 min and then do the tasks.. how to do it in Unix script? any idea? (3 Replies)
Discussion started by: redlotus72
3 Replies
2. Shell Programming and Scripting
how to find the chid process id from given parent process id.... (the chid process doesnot have sub processes inturn) (3 Replies)
Discussion started by: guhas
3 Replies
3. HP-UX
Hi,
Can anyone help me out in writing the shell scrip which monitors a process which is running and gives me the output of the memory being used by the process, I have the requirement of monitorig the memory usage of the process when it is running.
Please help me out (3 Replies)
Discussion started by: vijayagiri
3 Replies
4. What is on Your Mind?
What is your age? (15 Replies)
Discussion started by: royal
15 Replies
5. Shell Programming and Scripting
KSH:
Please lt me know how to find the age of a file in minutes(Based on last modified time).
ie, if the file was modified 15 Minutes ago, the output should be 15 (1 Reply)
Discussion started by: hari_anj
1 Replies
6. Shell Programming and Scripting
I am trying to figure out how to look at only the following directory...
/lcl/prd/data/dc003p/dump
And search it for any files that have a .arc extension and are older then 24 hours.
I have never done anything like this and have no idea where to start. I want to make sure it does not... (10 Replies)
Discussion started by: LRoberts
10 Replies
7. Shell Programming and Scripting
I had issues with processes locking up. This script checks for processes and kills them if they are older than a certain time.
Its uses some functions you'll need to define or remove, like slog() which I use for logging, and is_running() which checks if this script is already running so you can... (0 Replies)
Discussion started by: sukerman
0 Replies
8. Shell Programming and Scripting
Hi
I can not say that i am new to perl but today i learned something new, i wanted to know age (last time file got modified) of file so i initially thought of using find -mtime command but when i googled it, i found perl solution for the same
my $age = -M $ARGV ;
print "$ARGV age is... (1 Reply)
Discussion started by: zedex
1 Replies
9. Programming
Hi:
I have a program written in FORTRAN running on AIX platform.
It is because missing of documentation and without root password, therefore we want to modify the program so that we can find out which script/program that call this FORTRAN program.
I have google for few days, all of them are... (3 Replies)
Discussion started by: cstsang
3 Replies
10. UNIX for Dummies Questions & Answers
I want a script that will identify all processes for a particular id and kill it if its running more than 5 hours.
i have tried to make it but dont know how to find to retrive the process running more than 5 hours.
tried below:
ps -eo pid,etime,comm,user,tty | grep sas
please help... (1 Reply)
Discussion started by: milan111
1 Replies
LEARN ABOUT OPENSOLARIS
ptree
ptree(1) User Commands ptree(1)
NAME
ptree - print process trees
SYNOPSIS
/usr/bin/ptree [-a] [-c] [-z zone] [pid | user]...
DESCRIPTION
The ptree utility prints the process trees containing the specified pids or users, with child processes indented from their respective par-
ent processes. An argument of all digits is taken to be a process-ID, otherwise it is assumed to be a user login name. The default is all
processes.
OPTIONS
The following options are supported:
-a All. Print all processes, including children of process 0.
-c Contracts. Print process contract memberships in addition to parent-child relationships. See process(4). This option implies the
-a option.
-z zone Zones. Print only processes in the specified zone. Each zone ID can be specified as either a zone name or a numerical zone ID.
This option is only useful when executed in the global zone.
OPERANDS
The following operands are supported:
pid Process-id or a list of process-ids. ptree also accepts /proc/nnn as a process-id, so the shell expansion /proc/* can be used to
specify all processes in the system.
user Username or list of usernames. Processes whose effective user IDs match those given are displayed.
EXAMPLES
Example 1 Using ptree
The following example prints the process tree (including children of process 0) for processes which match the command name ssh:
$ ptree -a `pgrep ssh`
1 /sbin/init
100909 /usr/lib/ssh/sshd
569150 /usr/lib/ssh/sshd
569157 /usr/lib/ssh/sshd
569159 -ksh
569171 bash
569173 /bin/ksh
569193 bash
EXIT STATUS
The following exit values are returned:
0 Successful operation.
non-zero An error has occurred.
FILES
/proc/* process files
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|Interface Stability |See below. |
+-----------------------------+-----------------------------+
The human readable output is Unstable. The options are Evolving.
SEE ALSO
gcore(1), ldd(1), pargs(1), pgrep(1), pkill(1), plimit(1), pmap(1), preap(1), proc(1), ps(1), ppgsz(1), pwd(1), rlogin(1), time(1),
truss(1), wait(1), fcntl(2), fstat(2), setuid(2), dlopen(3C), signal.h(3HEAD), core(4), proc(4), process(4), attributes(5), zones(5)
SunOS 5.11 11 Oct 2005 ptree(1)