#! /bin/sh
#get_current_time
export JAVA_HOME=/opt/jdk1.6.0_10/
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
date=`date "+%Y-%m-%d-%H:%M:%S"`
Root="/data/dxm/"
jmapends=$Root$date"_jmap.txt"
jstackends=$Root$date"_jstack.txt"
jstateends=$Root$date"_jstate.txt"
#start to register the jmap message
echo "start to register the jmap to "$jmapends
jmap -histo:live `jps|grep Resin |awk 'NR==1'|awk '{print $1}'` > $jmapends
sleep 2
#start to register the jtack message
echo "start to register the jstack to "$jstackends
jstack -l `jps|grep Resin |awk 'NR==1'|awk '{print $1}'` > $jstackends
sleep 2
#start to register the jstate message
echo "start to register the jstate message to "$jstateends
jstat -gcutil -t -h20 `jps|grep Resin |awk 'NR==1'|awk '{print $1}'` 1000 20 > $jstateends
这个可以跑个定时器:
crontab -e
*/10 * * * * sh /timer/timer.sh #每十分钟抓一次
第二个脚本:比较两个版本中jar包是否相同(有改变):
#! /bin/sh
#compare the lib files's md5 int file1 with those in file2
#if it only exist in file1 or one lib file's md5 is not equal i
#with the other then print it to the log.txt
LibPath1=$1
LibPath2=$2
date=`date "+%Y-%m-%d-%H:%M:%S"`
LOG=$date"_log.txt"
echo "-----------log file " $LOG
echo LibPath1: $LibPath1
echo LibPath2: $LibPath2
echo LibPath1: $LibPath1 \n >> $LOG
echo LibPath2: $LibPath2 \n >> $LOG
echo >> $LOG
echo >> $LOG
for File in `ls -f $LibPath1|grep jar `;
do
MD5=`md5sum $1$File |awk 'NR==1'|awk '{print $1}'`
File2=$LibPath2$File
#echo "File2-----------------" $File2
#if the same lib file exist
if [ ! -f "$File2" ]; then
echo $File only exist LibPath1
echo $File only exist LibPath1 \n >> $LOG
echo >> $LOG
#if the same file exist in directory2
else
MD52=`md5sum $File2 |awk 'NR==1'|awk '{print $1}'`
if [ "$MD5" != "$MD52" ]; then
echo the $File changed \n >> $LOG
echo >> $LOG
echo the $File changed
fi
fi
done
上的那个文件为
md5compare.sh
运行是可以用以下命令运行:
./md5compare.sh libpath1 libpath2
注意libpath1,libpath2 必须以"/" 结尾比如:
/opt/ROOT_2011-09-08-09:57:26/WEB-INF/lib/
而不是
/opt/ROOT_2011-09-08-09:57:26/WEB-INF/lib
分享到:
相关推荐
jar 库,它使您无需为每个问题设置解决方案测试脚手架。 生成解决方案/测试框架,编译,通过一行命令进行测试。 集成了Junit 4 、 log4j 、 slf4j 。 com.ciaoshen.leetcode.util包为TreeNode 、 ListNode等 7 种...
jar 库,它使您无需为每个问题设置解决方案测试脚手架。 生成解决方案/测试框架,编译,通过一行命令进行测试。 集成了Junit 4 、 log4j 、 slf4j 。 com.ciaoshen.leetcode.util包为TreeNode 、 ListNode等 7 种...
val data = Seq(1, 2, 3, 4, 5) val distData = sc.parallelize(data) distData.reduce(_ + _) ``` #### 二、使用教程 ##### 1. Hadoop基本使用 - **上传文件到HDFS**: ``` hdfs dfs -put localfile.txt /...
其中,`command`类型任务通常用于执行shell命令或脚本,而`java`类型任务则常用于执行Java类。 #### 二、Command类型单一Job示例 ##### 创建Job描述文件 以`command`类型为例,创建一个简单的`command.job`文件:...