Mercurial > logstash
view Kibana.rc @ 25:d058481276aa
replace logstash embedded web server with kibana
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 29 Apr 2013 13:38:05 -0700 |
parents | |
children | 610835fb4209 |
line wrap: on
line source
#!/bin/bash # # /etc/rc.d/init.d/Kibana # # Starts Kibana as a daemon # # chkconfig: 2345 20 80 # description: Starts Kibana as a daemon # pidfile: /var/run/Kibana.pid ### BEGIN INIT INFO # Provides: Kibana # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: S 0 1 6 # Short-Description: Kibana # Description: Starts Kibana as a daemon. ### END INIT INFO DESC="Kibana Daemon" JAVA=$(which java) if [ "$(which jruby 2>/dev/null)" == '' ]; then JRUBY_CMD="$JAVA -jar /usr/share/jruby.jar" else JRUBY_CMD="jruby" fi LOGFILE=/var/log/Kibana/Kibana.log PIDFILE=/var/run/Kibana.pid base=Kibana . /etc/init.d/functions # # Function that starts the daemon/service # do_start() { cd /usr/share/java/Kibana pid=$( exec sudo -u kibana /bin/bash - <<EOF export GEM_HOME=$(pwd) export GEM_PATH= $JRUBY_CMD kibana.rb >$LOGFILE 2>&1 & echo \$! EOF ) echo $pid >$PIDFILE [ -n "$pid" ] && success $"$base startup" || failure $"$base startup" } # # Function that stops the daemon/service # do_stop() { killproc -p $PIDFILE Kibana } case "$1" in start) echo -n "Starting $DESC: " do_start touch /var/lock/subsys/$base ;; stop) echo -n "Stopping $DESC: " do_stop rm /var/lock/subsys/$base 2>/dev/null rm $PIDFILE 2>/dev/null ;; restart) echo -n "Restarting $DESC: " do_stop do_start ;; reload) echo -n "Reloading $DESC: " pid=$(cat $PIDFILE) [ -n "$pid" ] && pkill -HUP -u Kibana -P $pid ;; status) echo -n "$base " status -p $PIDFILE ;; *) echo "Usage: service $base {start|stop|status|restart}" >&2 exit 3 ;; esac echo exit 0