[Solved] How to remove / kill defunct processess? | Unix Linux Forums | HP-UX

  Go Back    


HP-UX HP-UX (Hewlett Packard UniX) is Hewlett-Packard's proprietary implementation of the Unix operating system, based on System V.

[Solved] How to remove / kill defunct processess?

HP-UX


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 04-01-2010
jinslick25 jinslick25 is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 5 May 2011, 2:11 AM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Question [Solved] How to remove / kill defunct processess?

Hi,

Is there a way or a command to remove defunct processes on my hp-ux server?

Its shows a lot of them and i think its affecting the performance of the server.


Code:
who -d |wc -l
580

who -d shows

Code:
aktarafr   pts/109      Oct  1 15:05
passji     pts/119      Feb 25 14:20
forthm     pts/123      Jun 25 14:30
morrisgr   pts/tg       Apr  1 16:03
perumalb   pts/th       Mar 26 13:38
ahmadi     pts/ti       Mar 25 16:58
   .       pts/8        Jul 22 11:05
finlayma   pts/128      Jul 22 17:07
joeg       pts/132      Jun 25 17:37
rajera     pts/133      Jun 11 11:41
jurasikc   pts/134      Jun 12 14:10
   .       pts/135      May 30 18:22
   .       pts/136      May 19 08:35
   .       pts/137      Sep 17 05:39
limpocoj   pts/138      Sep 18 19:37
scottjon   pts/139      May 27 15:46
duyejia    pts/141      Apr  1 23:32
   .       pts/145      Sep 25 13:26
kimsa      pts/147      Sep 23 15:39
gillmerr   pts/148      May 21 17:05
beheraa    pts/149      Apr  2 00:42
burslemm   pts/150      Jun 22 19:05
   .       pts/151      Sep 18 18:50
aminmoh    pts/152      Jul 22 17:46
nbu        pts/153      Sep 18 22:01
contrerf   pts/155      Sep 17 18:06
   .       pts/9        May 20 18:17
hillc      pts/157      Jun 11 22:14
   .       pts/163      Oct 12 13:08
cruzgen    pts/165      Sep 19 00:14
morrisgr   pts/tj       Mar 25 16:58
duyejia    pts/tk       Mar 19 12:38
leeden     pts/167      Jun 11 21:27
villelar   pts/168      Nov 10 20:18
magatale   pts/169      Sep 15 12:47
addulara   pts/171      Jun 12 00:03
burslemm   pts/170      Jun 22 19:04
   .       pts/173      Sep 24 17:54
   .       pts/174      Sep 23 09:43
tanles     pts/175      Apr  1 18:31
badiv      pts/177      Sep 18 17:29
leoneroi   pts/178      Sep 23 17:26
andzakde   pts/179      Mar 16 16:56

Thanks
Sponsored Links
    #2  
Old 04-01-2010
mikep9 mikep9 is offline
Registered User
 
Join Date: Oct 2009
Last Activity: 14 December 2010, 11:36 AM EST
Location: DFW, TX
Posts: 37
Thanks: 0
Thanked 1 Time in 1 Post
on sco unix

kill -10 pid#
Sponsored Links
    #3  
Old 04-01-2010
jinslick25 jinslick25 is offline
Registered User
 
Join Date: Jan 2010
Last Activity: 5 May 2011, 2:11 AM EDT
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
but how can i get their PID?
    #4  
Old 04-01-2010
TonyFullerMalv's Avatar
TonyFullerMalv TonyFullerMalv is offline Forum Advisor  
Registered User
 
Join Date: Sep 2008
Last Activity: 1 July 2013, 6:45 PM EDT
Location: Malvern, Worcs. U.K.
Posts: 1,033
Thanks: 0
Thanked 8 Times in 8 Posts
How about:


Code:
ps -ef | grep defunct

?

The following seems to indicate that one can "kill -9" a defunct process:
Kill defunct process without root
Sponsored Links
    #5  
Old 04-07-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 673 Times in 642 Posts
Quote:
who -d
This "who" command does not show current defunct processes.
It shows current users logged in and some debris left in /etc/utmp - usually left after killing orphan processes.
A reboot clears the list.


Code:
who -ud

Shows the list complete with PIDs. Don't kill those PIDs because the main reasons the PID would exist is
because this is a current user session or because the PID has been re-used since an "old" session died untidily
sometime in the past.

This command shows defunct processes, though they are usually harmless and disappear with time:

Code:
ps -ef|grep "defunct"|grep -v "grep"


Last edited by methyl; 04-07-2010 at 11:16 AM..
Sponsored Links
    #6  
Old 04-07-2010
jgt's Avatar
jgt jgt is offline Forum Advisor  
Registered User
 
Join Date: Apr 2007
Last Activity: 29 October 2014, 3:49 PM EDT
Location: 44.21.48N 80.50.15W
Posts: 1,560
Thanks: 1
Thanked 159 Times in 151 Posts
This issue seems to be caused by users closing Windows terminal emulation sessions without first signing off, (clicking on the X before exiting the session.)
On SCO systems, these "ghost" sessions tend to consume all the available CPU trying to re-connect.
I wrote the following script to deal with this issue, but it should be used with caution.
On SCO systems telnet sessions are named ttypnn, on HP-UX it appears they are named pts/nnn.


Code:
#!/bin/ksh
if [ $# -eq 0 ]
then
echo Usage is delete.ghosts  Y or N
exit 1
fi
ps -leaf |grep ttyp >/tmp/ps.list
who >/tmp/user.list
LIST=; export LIST
separator=" "
while read a tty c 
do
LIST=$LIST$separator$tty
separator=" |"
done </tmp/user.list
grep -v "?" </tmp/ps.list |grep -v root |\
grep -E -v "$LIST" >/tmp/ghost.list
while read a b user pid e f
do
if [ $1 = Y ]
then
echo for real $user $pid
echo kill -9 $pid
#kill -9 $pid
else
echo test run $user $pid
echo kill -9 $pid
fi
done </tmp/ghost.list
#

Sponsored Links
    #7  
Old 04-07-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 673 Times in 642 Posts
@jgt

The script you post is terrifying, but I follow the basic reasoning. I would recommend that nobody runs that script on an operational system - especially one which has data.

Sorry, but it is scripts such as this which issue "kill -9" arbitarily actually cause the situation which we see with "who -d" in the original post.

If you were forced to issue a kill against orphan interractive process it should be "kill -15" or whatever "kill" signal is required by the application.

Never issue "kill -9" unless you are having trouble shutting a system down or encounter a process which is definitely stuck on impossible I/O.

Last edited by methyl; 04-07-2010 at 08:06 PM.. Reason: typo
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Defunct process fugitive Solaris 3 05-07-2009 07:55 AM
how do I kill defunct processes? csaunders Solaris 10 01-28-2008 03:49 PM
defunct process on HP shriashishpatil UNIX for Advanced & Expert Users 1 12-08-2006 08:08 AM
child processess uni_ajay_r Shell Programming and Scripting 3 10-04-2006 09:51 AM
When kill doesnt work, how to kill a process ? VijayHegde UNIX for Advanced & Expert Users 3 05-12-2006 04:24 PM



All times are GMT -4. The time now is 04:01 PM.