LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   how to find how long a process is sleeping? (https://www.linuxquestions.org/questions/linux-server-73/how-to-find-how-long-a-process-is-sleeping-919646/)

kingston 12-20-2011 05:35 AM

how to find how long a process is sleeping?
 
Hi Gurus

My servers are showing that quite large number of processes are in sleeping mode. But couldnt find how long the processess are in sleep mode. Can someone tell me how to find this?

OS: RHEL server release 5.4
HW: X86_64

Quote:


top - 17:05:08 up 38 days, 18:04, 227 users, load average: 0.90, 0.66, 0.62
Tasks: 1668 total, 1 running, 1555 sleeping, 107 stopped, 5 zombie
Cpu(s): 0.8%us, 0.7%sy, 0.0%ni, 98.2%id, 0.1%wa, 0.0%hi, 0.1%si, 0.0%st
Mem: 16432968k total, 16319456k used, 113512k free, 34732k buffers
Swap: 18481144k total, 140k used, 18481004k free, 8250264k cached

blue_print 12-21-2011 04:26 AM

If you do 'ps -aux', it will show starting time of all processes and there you can identify which process is running long time.

kingston 01-05-2012 02:29 AM

1 Attachment(s)
hi

thanks for the reply. But when i do "ps -aux" now, it shows "2011" as the process start time, instead of giving exact "date & time". And also i couldnt understand the status like "Ss" "SN" "S<" "S+" "S<s""SsL""S<sl""S<Ls""Ss+". My intention is to kill the process which is sleeping for so long time and it shouldnt affect the Operating systems operations too..

Please find the attachment.

Satyaveer Arya 01-05-2012 02:52 AM

Use :

# ps -eo pid,cmd,etime

will output all processes, with formatters to get PID, command run, and elapsed time.

deep27ak 01-05-2012 05:22 AM

Quote:

Originally Posted by kingston (Post 4554365)
Hi Gurus

My servers are showing that quite large number of processes are in sleeping mode. But couldnt find how long the processess are in sleep mode. Can someone tell me how to find this?

OS: RHEL server release 5.4
HW: X86_64

First of all have a look of all the processes which are running in background or stopped

Code:

#jobs
#ps -u | grep T  <---will look for stopped process and show you the time as well
#ps -u | grep Z  <--will lookout for zombie process

for example
Code:

#ps -u | grep T
USER      PID %CPU %MEM    VSZ  RSS TTY      STAT START  TIME COMMAND
root      2210  0.1  0.0  4244  756 pts/1    T    22:23  0:00 cp -i /yum/

then to kill the jobs
Code:

#kill -9 pid no.


All times are GMT -5. The time now is 03:46 PM.