分类: 系统运维
2015-04-01 14:03:02
#!/bin/bash
if [ $# -lt 1 ]; then
echo "tomcat instance ID is required, e.g 01 02"
echo "USAGE: $0 instanceID"
exit 1
fi
host=`hostname`
for id in $@
do
$jid =>process ID( PID)
echo "saving jstack to tomcat instance ${jid} "
jstack -l ${jid} > /home/zapp/apps/${id}/logs/jstack-$host.${id}-`date +%Y%m%d%H%M`.log
echo "saving jmap to tomcat instance ${jid}.... "
jmap -dump:live,format=b,file=/home/zapp/apps/${id}/logs/jmap-$host.${id}-`date +%Y%m%d%H%M`.bin $jid
done