#!/bin/sh
# Run logstash from source
#
# This is most useful when done from a git checkout.
#
# Usage:
#   bin/logstash <command> [arguments]
#
# See 'bin/logstash help' for a list of commands.
#
# Supported environment variables:
#   LS_HEAP_SIZE="xxx" size for the -Xmx${LS_HEAP_SIZE} maximum Java heap size option, default is "500m"
#   LS_JAVA_OPTS="xxx" to append extra options to the defaults JAVA_OPTS provided by logstash
#   JAVA_OPTS="xxx" to *completely override* the defauls set of JAVA_OPTS provided by logstash
#
# Development environment variables:
#   USE_RUBY=1 to force use the local "ruby" command to launch logstash instead of using the vendored JRuby
#   USE_DRIP=1 to force use drip
#   DEBUG=1 to output debugging information

unset CDPATH
. "$(cd `dirname $0`/..; pwd)/bin/logstash.lib.sh"
setup

case $1 in
  -*)
    ruby_exec "${LOGSTASH_HOME}/lib/bootstrap/environment.rb" "logstash/runner.rb" "agent" "$@"
    ;;
  *)
    ruby_exec "${LOGSTASH_HOME}/lib/bootstrap/environment.rb" "logstash/runner.rb" "$@"
    ;;
esac
