agent.sh 1.5 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # Licensed to the Apache Software Foundation (ASF) under one or more
  3. # contributor license agreements. See the NOTICE file distributed with
  4. # this work for additional information regarding copyright ownership.
  5. # The ASF licenses this file to You under the Apache License, Version 2.0
  6. # (the "License"); you may not use this file except in compliance with
  7. # the License. You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. pid=$$
  17. bin=`dirname "$0"`
  18. bin=`cd "$bin"; pwd`
  19. . "$bin"/chukwa-config.sh
  20. echo "hadoop jar for agent is " ${HADOOP_JAR}
  21. trap '${JPS} | grep ChukwaAgent | grep -v grep | cut -f 1 -d" " | xargs kill -TERM ; exit 0' 1 2 15
  22. if [ "X$1" = "Xstop" ]; then
  23. echo -n "Shutting down agent..."
  24. JETTY_PID=`${JPS} | grep ChukwaAgent | grep -v grep | cut -f 1 -d" "`
  25. kill -TERM ${JETTY_PID} >&/dev/null
  26. echo "done"
  27. exit 0
  28. fi
  29. ${JAVA_HOME}/bin/java -Xms32M -Xmx64M -DAPP=agent -Dlog4j.configuration=chukwa-log4j.properties -DCHUKWA_HOME=${CHUKWA_HOME} -DCHUKWA_CONF_DIR=${CHUKWA_CONF_DIR} -DCHUKWA_LOG_DIR=${CHUKWA_LOG_DIR} -classpath ${CLASSPATH}:${CHUKWA_AGENT}:${CHUKWA_CORE}:${HADOOP_JAR}:${COMMON}:${CHUKWA_CONF_DIR} org.apache.hadoop.chukwa.datacollection.agent.ChukwaAgent $@