#!/bin/sh

# This script executes a basic Hadoop job.  It is an example of how
# you can setup a script to run an Hadoop job.  It is set by setting
# MAGPIE_JOB_TYPE to "script" and setting MAGPIE_JOB_SCRIPT
# environment variable to the script.  See the job submission file for
# details.
#
# Please adjust to whatever you would want to do with Hadoop

cd ${HADOOP_HOME}

command="bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-$HADOOP_VERSION.jar teragen 50000000 terasort-example-job-teragen"
echo "Running $command" >&2
$command

command="bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-$HADOOP_VERSION.jar terasort -Dmapred.reduce.tasks=1 terasort-example-job-teragen terasort-example-job-sort"

echo "Running $command" >&2
$command

command="bin/hadoop fs -rm -r terasort-example-job-teragen"
$command
command="bin/hadoop fs -rm -r terasort-example-job-sort"
$command

exit 0
