wiki:waue/2010/0126

Version 1 (modified by waue, 15 years ago) (diff)

--

#!/bin/bash
if [ "$1" == "" ];then
        echo "  Usage: "
        echo "       xxxrun <jar-file> <main-func-name> [arg1 arg2 ...] "
        echo ""
        echo "  this program will run your hadoop code "
        echo "  ======================================="
        exit 0;
fi

echo " 1. Now! run your hadoop code .."

/opt/hadoop/bin/hadoop jar $1 $2 $3 $4 $5

if [ "$?" != "0" ];then
        echo " hadoop run error !"
        exit 1;
fi

echo " 3. tsmrun  Finish !!"

#!/bin/bash
if [ "$1" == "" ];then
        echo "  Usage: "
        echo "       tsmcompiler <java-name> "
        echo "  Example: "
        echo "  if you want compiler aaaa.java , you can run"
        echo "  $\>  tsmcompiler aaaa "
        echo ""
        echo "  ==      this program will           =="
        echo "  1. Compiler your hadoop or hbase code "
        echo "  2. tar your java codes as jar "
        echo "  ======================================"
        exit 0;
fi

code_path=~/my-hadoop-code
mkdir $code_path

#name=echo $1|sed 's/\..*//'
#echo "name= $name"
#exit 0

if [ "$?" != "0" ];then
        echo "compiler error !"
        rm -rf $code_path
        exit 1;
fi

javac -cp xxxxx  -d $code_path $1.java

echo "    your program is correct, compiler is done!!! "

echo " 2. tar your java jar file....."

jar -cvf $1.jar -C $code_path .

if [ "$?" != "0" ];then
        echo "jar file error!"
        rm -rf $code_path
        exit 1;
fi

echo " 3. tsmcompiler  Finish !!"
echo "    the jar file is $1.jar"