1 | #!/bin/bash |
---|
2 | |
---|
3 | # Licensed to the Apache Software Foundation (ASF) under one |
---|
4 | # or more contributor license agreements. See the NOTICE file |
---|
5 | # distributed with this work for additional information |
---|
6 | # regarding copyright ownership. The ASF licenses this file |
---|
7 | # to you under the Apache License, Version 2.0 (the |
---|
8 | # "License"); you may not use this file except in compliance |
---|
9 | # with the License. You may obtain a copy of the License at |
---|
10 | # |
---|
11 | # http://www.apache.org/licenses/LICENSE-2.0 |
---|
12 | # |
---|
13 | # Unless required by applicable law or agreed to in writing, software |
---|
14 | # distributed under the License is distributed on an "AS IS" BASIS, |
---|
15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
16 | # See the License for the specific language governing permissions and |
---|
17 | # limitations under the License. |
---|
18 | |
---|
19 | # First we need to determine whether Failmon has been distributed with |
---|
20 | # Hadoop, or as standalone. In the latter case failmon.jar will lie in |
---|
21 | # the current directory. |
---|
22 | |
---|
23 | JARNAME="failmon.jar" |
---|
24 | HADOOPDIR="" |
---|
25 | CLASSPATH="" |
---|
26 | |
---|
27 | if [ `ls -l | grep src | wc -l` == 0 ] |
---|
28 | then |
---|
29 | # standalone binary |
---|
30 | if [ -n $1 ] && [ "$1" == "--mergeFiles" ] |
---|
31 | then |
---|
32 | jar -ufe $JARNAME org.apache.hadoop.contrib.failmon.HDFSMerger |
---|
33 | java -jar $JARNAME |
---|
34 | else |
---|
35 | jar -ufe $JARNAME org.apache.hadoop.contrib.failmon.RunOnce |
---|
36 | java -jar $JARNAME $* |
---|
37 | fi |
---|
38 | else |
---|
39 | # distributed with Hadoop |
---|
40 | HADOOPDIR=`pwd`/../../../ |
---|
41 | CLASSPATH=$CLASSPATH:$HADOOPDIR/build/contrib/failmon/classes |
---|
42 | CLASSPATH=$CLASSPATH:$HADOOPDIR/build/classes |
---|
43 | CLASSPATH=$CLASSPATH:`ls -1 $HADOOPDIR/lib/commons-logging-api-1*.jar` |
---|
44 | CLASSPATH=$CLASSPATH:`ls -1 $HADOOPDIR/lib/commons-logging-1*.jar` |
---|
45 | CLASSPATH=$CLASSPATH:`ls -1 $HADOOPDIR/lib/log4j-*.jar` |
---|
46 | # echo $CLASSPATH |
---|
47 | if [ -n $1 ] && [ "$1" == "--mergeFiles" ] |
---|
48 | then |
---|
49 | java -cp $CLASSPATH org.apache.hadoop.contrib.failmon.HDFSMerger |
---|
50 | else |
---|
51 | java -cp $CLASSPATH org.apache.hadoop.contrib.failmon.RunOnce $* |
---|
52 | fi |
---|
53 | fi |
---|
54 | |
---|