Created
November 6, 2012 03:14
-
-
Save pfmiles/4022336 to your computer and use it in GitHub Desktop.
crontab根据load阀值自动记录jstack结果的脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
waterMark=10 | |
pid=`/usr/alibaba/java/bin/jps|grep AvatarEngine|cut -d ' ' -f 1` | |
curLoad=`cat /proc/loadavg |cut -d ' ' -f 1` | |
file="/tmp/$pid-`date +%Y-%m-%d-%H-%M-%S`-stack$curLoad.log" | |
if [ 1 == `echo "$curLoad > $waterMark"|bc` ];then | |
/usr/alibaba/java/bin/jstack $pid > $file | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment