Monday, April 06, 2009

Killing defunct processes in Solaris 9 and 10

Recently I found out that you can "kill" those <defunct> processes in Solaris 9 and 10. The command is preap. You can specify all the <defunct> process IDs in one command line or you can make use of xargs to construct the argument list on the fly

# uname -a
SunOS myhost  5.10 Generic_118833-24 sun4u sparc SUNW,Sun-Fire-V490

# ps -ef | grep defunct
  daemon 25694   338   0        - ?           0:00 <defunct>
  daemon  8726   338   0        - ?           0:00 <defunct>
  daemon  8523   338   0        - ?           0:00 <defunct>
  daemon 11023   338   0        - ?           0:00 <defunct>
  daemon 25420   338   0        - ?           0:00 <defunct>
  ...
# ps -ef | grep -c defunct
606

# ps -ef -o 'pid,comm' | awk '/<defunct>/{print $1}' | xargs preap

Labels:

0 Comments:

Post a Comment

<< Home