-
Notifications
You must be signed in to change notification settings - Fork 6
/
goraci.sh
executable file
·104 lines (92 loc) · 2.7 KB
/
goraci.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh
#
# The Goraci command script
#
# Environment Variables
#
# GORACI_JAVA_HOME The java implementation to use. Overrides JAVA_HOME.
#
# GORACI_HEAPSIZE The maximum amount of heap to use, in MB.
# Default is 1000.
#
# GORACI_OPTS Extra Java runtime options.
#
# resolve links - $0 may be a softlink
THIS="$0"
while [ -h "$THIS" ]; do
ls=`ls -ld "$THIS"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
THIS="$link"
else
THIS=`dirname "$THIS"`/"$link"
fi
done
# if no args specified, show usage
if [ $# = 0 ]; then
echo "Usage: run COMMAND [COMMAND options]"
echo "where COMMAND is one of:"
echo " Generator A map only job that generates data."
echo " Verify A map reduce job that looks for holes.
Look at the counts after running.
REFERENCED and UNREFERENCED are ok,
any UNDEFINED counts are bad. Do not
run at the same time as the Generator."
echo " Walker A standalong program that starts
following a linked list and emits
timing info."
echo " Print A standalone program that prints nodes
in the linked list."
echo " Delete A standalone program that deletes a
single node."
echo " Loop A program to Loop through Generator and
Verify steps"
echo " or"
echo " CLASSNAME run the class named CLASSNAME"
echo "Most commands print help when invoked w/o parameters."
exit 1
fi
# get arguments
COMMAND=$1
shift
# some directories
THIS_DIR=`dirname "$THIS"`
GORACI_HOME=`cd "$THIS_DIR" ; pwd`
# cath when JAVA_HOME is not set
if [ "$JAVA_HOME" = "" ]; then
echo "Error: JAVA_HOME is not set."
exit 1
fi
# so that filenames w/ spaces are handled correctly in loops below
IFS=
# restore ordinary behaviour
unset IFS
# figure out which class to run
if [ "$COMMAND" = "Generator" ] ; then
CLASS=goraci.Generator
elif [ "$COMMAND" = "Verify" ] ; then
CLASS=goraci.Verify
elif [ "$COMMAND" = "Walker" ] ; then
CLASS=goraci.Walker
elif [ "$COMMAND" = "Print" ] ; then
CLASS=goraci.Print
elif [ "$COMMAND" = "Delete" ] ; then
CLASS=goraci.Delete
elif [ "$COMMAND" = "Loop" ] ; then
CLASS=goraci.Loop
else
CLASS=$1
shift
fi
# initial CLASSPATH
CLASSPATH=""
# add libs to CLASSPATH
SEP=""
for f in $GORACI_HOME/lib/*.jar; do
CLASSPATH=${CLASSPATH}$SEP$f;
SEP=":"
done
#run it
export HADOOP_CLASSPATH="$CLASSPATH"
LIBJARS=`echo $HADOOP_CLASSPATH | tr : ,`
hadoop jar "$GORACI_HOME/lib/goraci-0.0.1-SNAPSHOT.jar" $CLASS -libjars "$LIBJARS" "$@"