WebObjects/Web Applications/Deployment/Killing WOA Processes

This is one of the most vexing question. How to kill a run away WO application? The ps command does not give you any information as it list the process as java.

Try to use lsof. You need to run it with admin privileges so the command is

sudo lsof -i tcp:xxxx

Alternatively you can have a script:

#!/bin/sh # #  portslay:  kill the task listening on the specified TCP port # kill -9 `lsof -i tcp:$1 | grep LISTEN | awk '{ print $2;}'`

You will also have to do a sudo for the script to run.

For those stuck with the CLOSE_WAIT problems try this: sudo lsof -i tcp:xxxx

Alternatively you can have a script: #!/bin/sh # #  portslay:  kill the task listening on the specified TCP port # kill -9 `lsof -i tcp:$1 | grep CLOSE_WAIT | awk '{ print $2;}'`

run it by doing:

sudo ./portslay xxxx-yyyy

where xxxx is the first port and yyyy the last port

how about (pref. inside a script):

ps aux | grep java | grep  | grep -v grep | awk '{ print"kill -9 "$2 }' | sh

Mike Schrag
I just use

ps auxww

which will show the full commandline. You can see the app name from this view.

Fabian Peters
On FreeBSD one needs to set

kern.ps_arg_cache_limit=1024

in /etc/sysctl to reveal the full command line with ps -auxww. To set it immediately:

sysctl kern.ps_arg_cache_limit=1024

Alternatively, one can use Johan's script below.

Johan Henselmans
I have written a small script that uses lsof to find the process by looking at some specific file that is opened, the returned processes can then be used to kill the process


 * 1) !/bin/sh

if [ $# = 0 ]; then echo "" echo "  usage: $0 javaname(s)" echo "  The current processes that  containt javaname will be displayed" echo "  eg: $0 JavaMonitor.woa" echo "" exit 1 fi

OS=`uname -s` case ${OS} in 'FreeBSD') LSOF=/usr/local/sbin/lsof 'Linux') LSOF=/usr/sbin/lsof 'Darwin') LSOF=/usr/sbin/lsof echo "no lsof command available on this OS!"; exit 1 esac
 * 1) echo $OS

for i in $* do ${LSOF} -c java | grep -i $i | awk '{print $2}' | sort -u; done