On 14:43 06 Jun 2003, Javier Gostling <[EMAIL PROTECTED]> wrote: | I need to monitor the age of certain processes in my system in order to | prevent some processes that should only take a few seconds or minutes at most | from getting stuck endlessly. My last experience, I found one such process | running since May 19. | | What I need is some way to check a processes' start date and time, so I | can check it from my script and raise an alert if one of these processes | has gone wild. I'm sure /proc/<PID> must have the relevant data, but I don't | know where exactly. Does anyone know where I can find it?
/proc/<PID> doesn't seem to have this data. How lame:-( There are two other ways to attack this: your polling approach (look for old processes) or just run the commands involved inside a timeout program. For the polling approach you parse the output of: ps -o 'pid start_time cmd' ax which gets you a listing with just pid and start time and command. Or if you know the pid you can go: ps -o 'pid start_time cmd' <pid> For the timeout approach you invoke the process like this: timeout 10 command args... for a command that should run for at most 10 seconds. Timeout's a script you can get here: http://www.cskk.ezoshosting.com/cs/scripts/timeout Cheers, -- Cameron Simpson <[EMAIL PROTECTED]> DoD#743 http://www.cskk.ezoshosting.com/cs/ "Gosh, that's the 3rd motorcycle that's passed us. Sure do take their life in their hands, what with the weather and all." "Yes Janet, life's pretty cheap to that type." Audience: YEAH THAT TYPE!!!!!! -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED] https://www.redhat.com/mailman/listinfo/redhat-list