Every once in a while(while upgrading to new version, testing new versions), we need to kill all the servers(Weblogic AdminServer, nodemanager, managed server). Here is the simple command I use:
ps -e | grep [j]ava | awk '{print $1}' | xargs -l kill
Ofcourse this works fine for dedicated servers where no other java instance is running.
So why is [j]ava used instead of java? If the pattern had been written without the square brackets, it would have matched not only the ps output line for java, but also the ps output line for grep. Note that some platforms ps limit the ouput to the width of the screen, grep does not have any limit on the length of a line except the available memory.
You can find more of these tricks here with grep.
Friday, July 18, 2003
Killing all servers
Posted by Kumar at 10:55 AM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment