start pig using shell script

Here is an example to start pig script from shell:

bashprogname=basename $0

# Various config params

UDF_JARS_LOCATION=~/udf_jars

DEFAULT_JOIN_NUM_REDUCERS=2048

QUEUE=curveball_med

# Prepare Pig command

PIG_OPTS=-Dmapred.job.queue.name=${QUEUE} -Dmapred.child.java.opts=-Xmx2840m -Dmapred.job.map.memory.mb=4548 -Dmapred.job.reduce.memory.mb=4548 -Dmapreduce.jobtracker.split.metainfo.maxsize=20000000 -Dmapreduce.job.acl-view-job=* -Dmapreduce.job.acl-modify-job=* -Dmapreduce.job.classloader=false -Dio.sort.mb=1000 -Dio.sort.factor=100 -Dpig.stats.noTaskReport=true -Dexectype=mapreduce -Dmapred.cache.archives=hdfs…/xxx.tar.gz#achievePrefix -Dmapred.child.env=LD_LIBRARY_PATH=./achievePrefix/xxx/lib64

# Pig params

PIG_PARAMS= -param SOME_PATH=${SOME_PATH} -param DEFAULT_JOIN_NUM_REDUCERS=${DEFAULT_JOIN_NUM_REDUCERS} -param QUEUE=${QUEUE}

# Pig Jars location

PIG_JARS_FALCON= -Dpig.additional.jars=local…./apps/lib/xxxx.jar:local…/lib/commons-math-2.2.jar$UDF_JARS_LOCATION/datafu-1.2.0.jar:$UDF_JARS_LOCATION/xxxxxx.jar:$UDF_JARS_LOCATION/zzzzz.jar

pig -useHCatalog –conf /…./hbase/hbase-site.xml -useversion 0.11 ${PIG_OPTS} ${PIG_PARAMS} ${PIG_JARS_FALCON} somePigScript.pig