comparison logstash.rc @ 3:796ac0b50dbf

add cron.daily index cleaning
author Carl Byington <carl@five-ten-sg.com>
date Thu, 07 Mar 2013 10:41:01 -0800
parents df4952a2fb06
children 29ffaf4e0a7f
comparison
equal deleted inserted replaced
2:9e0cdf091b8a 3:796ac0b50dbf
27 DESC="Logstash Daemon" 27 DESC="Logstash Daemon"
28 JAVA=$(which java) 28 JAVA=$(which java)
29 CONFIGFILE=/etc/logstash/logstash.conf 29 CONFIGFILE=/etc/logstash/logstash.conf
30 LOGFILE=/var/log/logstash/logstash.log 30 LOGFILE=/var/log/logstash/logstash.log
31 JARNAME=/usr/local/bin/logstash.jar 31 JARNAME=/usr/local/bin/logstash.jar
32 ARGS="-jar ${JARNAME} agent -vvv --config ${CONFIGFILE} --log ${LOGFILE} -- web --backend elasticsearch://127.0.0.1/?local" 32 ARGS="-jar ${JARNAME} agent --config ${CONFIGFILE} --log ${LOGFILE} -- web --backend elasticsearch://127.0.0.1/?local"
33 SCRIPTNAME=/etc/rc.d/init.d/logstash 33 SCRIPTNAME=/etc/rc.d/init.d/logstash
34 PIDFILE=/var/run/logstash.pid 34 PIDFILE=/var/run/logstash.pid
35 base=logstash 35 base=logstash
36 36
37 # Exit if java is not installed 37 # Exit if java is not installed
48 do_start() { 48 do_start() {
49 cd $HOME 49 cd $HOME
50 pid=$(su logstash -c 'echo -e "'"$JAVA $ARGS"' </dev/null >'"$LOGFILE"' 2>&1 & \n echo \$!" | bash') 50 pid=$(su logstash -c 'echo -e "'"$JAVA $ARGS"' </dev/null >'"$LOGFILE"' 2>&1 & \n echo \$!" | bash')
51 echo $pid >$PIDFILE 51 echo $pid >$PIDFILE
52 [ -n "$pid" ] && success $"$base startup" || failure $"$base startup" 52 [ -n "$pid" ] && success $"$base startup" || failure $"$base startup"
53 # might try
54 #id
55 #exec sudo -u transmission /bin/sh - << eof
56 #id
57 #eof
53 } 58 }
54 59
55 60
56 # 61 #
57 # Function that stops the daemon/service 62 # Function that stops the daemon/service
82 echo -n "Reloading $DESC: " 87 echo -n "Reloading $DESC: "
83 pid=$(cat $PIDFILE) 88 pid=$(cat $PIDFILE)
84 [ -n "$pid" ] && pkill -HUP -u logstash -P $pid 89 [ -n "$pid" ] && pkill -HUP -u logstash -P $pid
85 ;; 90 ;;
86 status) 91 status)
92 echo -n "$base "
87 status -p $PIDFILE 93 status -p $PIDFILE
88 ;; 94 ;;
89 *) 95 *)
90 echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2 96 echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
91 exit 3 97 exit 3