Killing Java Process Instances on Linux

Almost all IT teams and companies, that uses enterprise java technologies on application servers or servlet containers, prefers running their systems on free or enterprise LINUX distributions. I am using an IBM AIX that hosts an IBM WebSphere Application Server for testing applications. Sometimes, restarting is unavoidable when OutOfMemoryError occurs due to frequent deployments on WAS. Anytime stopping all servers, nodes and deployment manager instances with using prepared batches in server installation directory.

./was/bin/ "server-name" -username "user-name" -password "password"
./was/bin/ -username "user-name" -password "password"
./was/bin/ -username "user-name" -password "password"

Instead of that, I wrote an SH script to kill all active processes that contains "java" keyoword in their names.

# retrieving active java instances' processIds
java_pids=$(ps -e | grep java | awk '{ print $1}')

# kill each  process id with "kill -9"
for java_pid in $java_pids
 echo "killing java process $java_pid"
 kill -9 $java_pid
## end of sh

take care.

Popular posts from this blog

SoapUI 4.5.0 Project XML File Encoding Problem

COMRESET failed (errno=-32)

SoapUI - Dynamic Properties - Getting Current Time in DateTime Format