etek
08-18-2004, 03:48 PM
Hello,
I am writing a script that will kill out-of-control processes (usually stick vim, tar, and apache processes). I've ran into a strange problem. I am using 'ps' to get the process statistics. If a process is running over a specified time (10-30 minutes), it will be killed. This is run on a cron to run every 10 minutes, so theoretically, no processes (in the list) should be running longer than 30 minutes.
If I run top and look at the times on the processes I'll see processes that have been running longer than 30 minutes ("34:10" for example). However, if I do a `ps aux | grep (PID)` then the time there only shows something like "0:18"? Am I missing something here? Is there a reason top reports it's been running for 34 minutes 10 seconds and ps reports it's been running for 18 seconds? Server is on a SMP kernel 2.4.20.
Thanks in advance
--
Linux Hosting Forum - http://www.linuxhostingforum.com
I am writing a script that will kill out-of-control processes (usually stick vim, tar, and apache processes). I've ran into a strange problem. I am using 'ps' to get the process statistics. If a process is running over a specified time (10-30 minutes), it will be killed. This is run on a cron to run every 10 minutes, so theoretically, no processes (in the list) should be running longer than 30 minutes.
If I run top and look at the times on the processes I'll see processes that have been running longer than 30 minutes ("34:10" for example). However, if I do a `ps aux | grep (PID)` then the time there only shows something like "0:18"? Am I missing something here? Is there a reason top reports it's been running for 34 minutes 10 seconds and ps reports it's been running for 18 seconds? Server is on a SMP kernel 2.4.20.
Thanks in advance
--
Linux Hosting Forum - http://www.linuxhostingforum.com