jenkins配置dump生成每日快照文件

BUILD_ID=pleaseDontKillMe

echo '生成快照文件'

for pid in $(ps -ef|grep /opt/copTomcat|grep -v grep|cut -c 10-15);
do
    echo $pid;
    cd /opt/copTomcat/bin
    echo ‘开始生成文件’;
    jmap -dump:format=b,file=java_pid$pid.hprof $pid
   echo ‘生成文件结束’;
done;

cd /opt/copTomcat/bin
echo '停止tomcat'
./shutdown.sh 

echo '启动tomcat'
./startup.sh 
echo '生成快照文件'

for pid in $(ps -ef|grep /opt/CopTimerTomcat|grep -v grep|cut -c 10-15);
do
    echo $pid;
    cd /opt/CopTimerTomcat/bin
    echo ‘开始生成文件’;
    jmap -dump:format=b,file=java_pid$pid.hprof $pid
   echo ‘生成文件结束’;
   echo ‘生成线程堆栈开始’;
   jstack -l $pid | tee -a jstack$pid.log
   echo ‘生成线程堆栈结束’;
done;
    原文作者:lunabird
    原文地址: https://www.jianshu.com/p/b5c4ee94a276
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞