failmon.sh 1.9 KB

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