How to combine find and zip to compress WebLogic ADR directories

Weblogic Server has an ADR folder containing a sub directory called incident. This directory holds one directory for each incident that happens during an application lifetime.

Each of these individual incident folder can be several Mega Bytes so i use the following to zip them up and delete them. I set it as a cron to run every 5 minutes.

find /MW_HOME/user_projects/domains/my_domain/servers/AdminServer/adr/diag/ofm/apps/myapp/incident  -iname "incdir_*" -type d -exec sh -c 'zip -r {}.zip {}' \; -exec rm -rf {} \;









How to create a Java Thread dump

To create a java thread dump in Linux you must send a QUIT signal to your java process. JVM then catches that and prints the thread dump to standard output. If you are running your program from a script that has it's output directed to a file the thread dump will be written to that file obviously .

So first do we need to find the PID of our java program.

ps -ef | grep java

for example this could return :

lapps     3243  3065 21 Nov12 ?        08:01:50 java -Xms2048m -Xmx10g -XX:MaxPermSize=256m -Djava.awt.headless=true -XX:+UseParallelGC -XX:-UseGCOverheadLimit -classpath .:./test.jar:./lib/:./lib/* mypackage.org.TestApp

Now that we have 3243 as the PID, we simply send a QUIT signal to it.

kill -QUIT 3243