Child pages
  • Killing WOA Processes

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

This is one of the most vexing question. How to kill a runaway WebObjects application? The ps command does not give you any information as it lists the process simply as java.

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

No Format
sudo lsof -i tcp:xxxx

Alternatively you can have a script:

Code Block
 #!/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:

No Format
sudo lsof -i tcp:xxxx

Alternatively you can have a script:

Code Block
 #!/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:

No Format
sudo ./portslay xxxx-yyyy

where xxxx is the first port and yyyy the last port


how about (pref. inside a script):

No Format
ps aux | grep java | grep <appName> | grep -v grep | awk '{ print"kill -9 "$2 }' | sh


Mike Schrag

I just use

No Format
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

No Format
kern.ps_arg_cache_limit=1024

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

No Format
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

Code Block
#!/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`
# echo $OS
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

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