Skip to content

Instantly share code, notes, and snippets.

@stahnma
Created July 10, 2012 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stahnma/3081399 to your computer and use it in GitHub Desktop.
Save stahnma/3081399 to your computer and use it in GitHub Desktop.
##########################################
# Init settings for logstash
###########################################
# Location of your Java binary (version 6 or higher)
JAVA_BIN="/usr/bin/java"
# Modify this if you'd like to change the memory allocation, enable JMX, etc
JAVA_ARGS="-Xmx192m "
# These normally shouldn't need to be edited if using OS packages
USER="logstash"
INSTALL_DIR="/usr/share/logstash"
CONFIG="/etc/logstash/standalone.conf"
Exception in thread "main" org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/awesome_print-0.4.0/lib/ap/core_ext/array
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/awesome_print-0.4.0/lib/ap.rb:12)
at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1612)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/awesome_print-0.4.0/lib/ap.rb:11)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/awesome_print-0.4.0/lib/ap.rb:59)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/cabin-0.1.3/lib/cabin/logger.rb:2)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/cabin-0.1.3/lib/cabin/logger.rb:36)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/cabin-0.1.3/lib/cabin/channel.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/cabin-0.1.3/lib/cabin/channel.rb:36)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/cabin-0.1.3/lib/cabin.rb:1)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/gems/cabin-0.1.3/lib/cabin.rb:59)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/logstash/logging.rb:2)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/logstash/logging.rb:36)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/logstash/filterworker.rb:2)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/logstash/filterworker.rb:36)
at #<Class:0x5a9bc984>.(root)(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/logstash/agent.rb:6)
at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1047)
at Kernel.require(file:/usr/share/logstash/logstash-1.1.0beta7-monolithic.jar!/logstash/agent.rb:36)
at logstash.runner.run(logstash/runner.rb:57)
at org.jruby.RubyProc.call(org/jruby/RubyProc.java:258)
at logstash.runner.run(logstash/runner.rb:83)
at logstash.runner.main(logstash/runner.rb:36)
at logstash.runner.(root)(logstash/runner.rb:108
#!/bin/sh
#
# logstash
#
# chkconfig: - 20 80
# description: logstash
### BEGIN INIT INFO
# Provides: logstash
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: logstash
# Description: Start logstash daemon placed in /etc/init.d.
### END INIT INFO
# Author: Michael Stahnke <stahnma@puppetlabs.com>
# Copyright 2012 Michael Stahnke
# Source function library.
. /etc/rc.d/init.d/functions
prog="logstash"
##########################################
# You should not have to edit this init script.
# Please attempt to make changes in /etc/sysconfig/logstash
##########################################
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
config=$CONFIG
PATH=/sbin:/usr/sbin:/bin:/usr/bin
JARFILE="logstash.jar"
JAVA_ARGS="${JAVA_ARGS} -jar ${INSTALL_DIR}/${JARFILE} agent -f ${CONFIG} -- web --backend elasticsearch:///?local"
EXTRA_ARGS="--chuid $USER --background --make-pidfile"
lockfile=/var/lock/subsys/$prog
EXEC="$JAVA_BIN $JAVA_ARGS"
PIDFILE="/var/run/$prog/$prog"
if `which runuser &> /dev/null` ; then
SU=runuser
else
SU=su
fi
find_my_pid() {
if [ ! -d "/var/run/$prog" ] ; then
mkdir -p /var/run/$prog
chown -R $USER:$USER /var/run/$prog
fi
pid=`ps -ef | grep $JAVA_BIN | grep $JARFILE | grep "${CONFIG}" | awk '{print $2}'`
}
start() {
# call status here and figure out current state
rh_status_q
[ -x $JAVA_BIN ] || exit 5
[ -f $config ] || exit 6
echo -n $"Starting $prog: "
$SU $USER -s /bin/bash -c "$EXEC &"
sleep 1
find_my_pid
echo $pid > $PIDFILE
[ -s $PIDFILE ] && success $"$base startup" || failure $"$base startup"
echo
[ -s $PIDFILE ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $prog: "
find_my_pid
if [ -s "$PIDFILE" ] ; then
kill `cat $PIDFILE`
else
kill $pid
fi
retval=$?
[ $retval -eq 0 ] && success $"$base stopped" || failure $"$base stopped"
echo
[ $retval -eq 0 ] && rm -f $lockfile $PIDFILE
return $retval
}
restart() {
stop
start
}
rh_status() {
status -p $PIDFILE $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
#rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
rh_status
;;
*)
echo $"Usage: $0 {start|stop|status|restart}"
exit 2
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment