diff logstash.rc @ 11:4899fb1b3eb3

add sysconfig snippet to avoid modifying non-config files
author Carl Byington <carl@five-ten-sg.com>
date Fri, 22 Mar 2013 13:45:38 -0700
parents e4ba03940224
children c158cae7cd26
line wrap: on
line diff
--- a/logstash.rc	Fri Mar 22 12:58:33 2013 -0700
+++ b/logstash.rc	Fri Mar 22 13:45:38 2013 -0700
@@ -23,20 +23,21 @@
 # Amount of memory for Java
 #JAVAMEM=256M
 
+. /etc/sysconfig/logstash
+
 export HOME=/var/lib/logstash
 DESC="Logstash Daemon"
 JAVA=$(which java)
 CONFIGFILE=/etc/logstash/logstash.conf
 LOGFILE=/var/log/logstash/logstash.log
 JARNAME=/usr/local/bin/logstash.jar
-ARGS="-jar ${JARNAME} agent --config ${CONFIGFILE} --log ${LOGFILE} -- web --backend elasticsearch://127.0.0.1/?local"
-SCRIPTNAME=/etc/rc.d/init.d/logstash
+ARGS="-jar $JARNAME agent --config $CONFIGFILE --log $LOGFILE $AGENTARGS -- web $WEBARGS"
 PIDFILE=/var/run/logstash.pid
 base=logstash
 
 # Exit if java is not installed
 if [ ! -x "$JAVA" ]; then
-    echo "Couldn't find $JAVA"
+    echo "Couldn't find java"
     exit 99
 fi
 
@@ -93,7 +94,7 @@
     status -p $PIDFILE
     ;;
   *)
-    echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
+    echo "Usage: service $base {start|stop|status|restart}" >&2
     exit 3
     ;;
 esac