annotate Kibana.rc @ 27:76544ad0561d

switch kibana to ruby gem rather than jruby
author Carl Byington <carl@five-ten-sg.com>
date Mon, 06 May 2013 23:31:24 -0700
parents 610835fb4209
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
1 #!/bin/bash
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
2 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
3 # /etc/rc.d/init.d/Kibana
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
4 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
5 # Starts Kibana as a daemon
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
6 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
7 # chkconfig: 2345 20 80
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
8 # description: Starts Kibana as a daemon
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
9 # pidfile: /var/run/Kibana.pid
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
10
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
11 ### BEGIN INIT INFO
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
12 # Provides: Kibana
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
13 # Required-Start: $local_fs $remote_fs
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
14 # Required-Stop: $local_fs $remote_fs
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
15 # Default-Start: 2 3 4 5
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
16 # Default-Stop: S 0 1 6
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
17 # Short-Description: Kibana
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
18 # Description: Starts Kibana as a daemon.
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
19
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
20 ### END INIT INFO
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
21
26
610835fb4209 external configuration for kibana
Carl Byington <carl@five-ten-sg.com>
parents: 25
diff changeset
22 . /etc/sysconfig/Kibana
610835fb4209 external configuration for kibana
Carl Byington <carl@five-ten-sg.com>
parents: 25
diff changeset
23
25
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
24 DESC="Kibana Daemon"
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
25 LOGFILE=/var/log/Kibana/Kibana.log
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
26 PIDFILE=/var/run/Kibana.pid
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
27 base=Kibana
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
28
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
29 . /etc/init.d/functions
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
30
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
31 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
32 # Function that starts the daemon/service
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
33 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
34 do_start() {
27
76544ad0561d switch kibana to ruby gem rather than jruby
Carl Byington <carl@five-ten-sg.com>
parents: 26
diff changeset
35 cd /home/kibana
25
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
36 pid=$(
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
37 exec sudo -u kibana /bin/bash - <<EOF
26
610835fb4209 external configuration for kibana
Carl Byington <carl@five-ten-sg.com>
parents: 25
diff changeset
38 export KIBANA_HOST=$KIBANA_HOST
610835fb4209 external configuration for kibana
Carl Byington <carl@five-ten-sg.com>
parents: 25
diff changeset
39 export KIBANA_PORT=$KIBANA_PORT
610835fb4209 external configuration for kibana
Carl Byington <carl@five-ten-sg.com>
parents: 25
diff changeset
40 export KIBANA_ES=$KIBANA_ES
27
76544ad0561d switch kibana to ruby gem rather than jruby
Carl Byington <carl@five-ten-sg.com>
parents: 26
diff changeset
41 export KIBANA_CONFIG=$KIBANA_CONFIG
76544ad0561d switch kibana to ruby gem rather than jruby
Carl Byington <carl@five-ten-sg.com>
parents: 26
diff changeset
42 kibana >>$LOGFILE 2>&1 &
25
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
43 echo \$!
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
44 EOF
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
45 )
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
46 echo $pid >$PIDFILE
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
47 [ -n "$pid" ] && success $"$base startup" || failure $"$base startup"
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
48 }
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
49
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
50
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
51 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
52 # Function that stops the daemon/service
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
53 #
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
54 do_stop() {
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
55 killproc -p $PIDFILE Kibana
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
56 }
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
57
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
58
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
59 case "$1" in
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
60 start)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
61 echo -n "Starting $DESC: "
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
62 do_start
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
63 touch /var/lock/subsys/$base
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
64 ;;
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
65 stop)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
66 echo -n "Stopping $DESC: "
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
67 do_stop
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
68 rm /var/lock/subsys/$base 2>/dev/null
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
69 rm $PIDFILE 2>/dev/null
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
70 ;;
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
71 restart)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
72 echo -n "Restarting $DESC: "
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
73 do_stop
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
74 do_start
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
75 ;;
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
76 reload)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
77 echo -n "Reloading $DESC: "
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
78 pid=$(cat $PIDFILE)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
79 [ -n "$pid" ] && pkill -HUP -u Kibana -P $pid
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
80 ;;
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
81 status)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
82 echo -n "$base "
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
83 status -p $PIDFILE
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
84 ;;
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
85 *)
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
86 echo "Usage: service $base {start|stop|status|restart}" >&2
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
87 exit 3
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
88 ;;
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
89 esac
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
90
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
91 echo
d058481276aa replace logstash embedded web server with kibana
Carl Byington <carl@five-ten-sg.com>
parents:
diff changeset
92 exit 0