Skip to content

Instantly share code, notes, and snippets.

@miglen
Created May 23, 2013 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miglen/5635214 to your computer and use it in GitHub Desktop.
Save miglen/5635214 to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Bash Script for Thread dump
# On WAS Application Server
#
if [ "$#" -ne 2 ]
then
echo "Usage: `dirname $0`/$0 <WAS Directory> <ServerName>"
exit 1
fi
PIDFILE=`find $1 -iname $2.pid 2>/dev/null`
if [ -s $PIDFILE ]
then
echo "$1 pid file found : $PIDFILE!"
PROCC1=`cat $PIDFILE`
PROCCE=`ps -fe | grep $PROCC1 | grep -v grep | wc -l`
if [ $PROCCE -eq 1 ]
then
echo "Generating thread dump of pid: $PROCC1"
kill -3 $PROCC1
else
echo "Proccess with pid $PROCC1 not found! Are you sure your server is up and running?"
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment