-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·31 lines (24 loc) · 887 Bytes
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
source ./config.sh
LAB=${1?Usage: $0 job}
PROPERTIES_LOCATION=$2
HDFS_LOCATION=$3
RAND_INPUT=$4
MAPS=$5
SAMPLES=$6
PROPERTIES=$PROPERTIES_LOCATION/job\.$RAND_INPUT\.properties
TEMPLATE=$PROPERTIES_LOCATION/job.properties.template
echo "Setting JT_URL and NN_URL in job.properties"
sed "s*JT_URL*$JT_URL*g" $TEMPLATE | sed "s*NN_URL*$NN_URL*g" | sed "s*MAPS*$MAPS*g" | sed "s*SAMPLES*$SAMPLES*g" | sed "s*HDFS_LOCATION*$HDFS_LOCATION*g" | sed "s*RAND_INPUT*$RAND_INPUT*g" > $PROPERTIES
echo "Executing Oozie command"
if [ "$KERBEROS" != "false" ]
then
OOZIE_COMMAND="oozie job -oozie $OOZIE_URL -config $PROPERTIES -auth KERBEROS -run"
else
OOZIE_COMMAND="oozie job -oozie $OOZIE_URL -config $PROPERTIES -run"
fi
echo $OOZIE_COMMAND
OOZIE_OUTPUT=`$OOZIE_COMMAND`
export JOBID=`echo $OOZIE_OUTPUT | grep job | awk '{print $2}'`
echo $JOBID > jobid.txt
echo $JOBID