File tree 3 files changed +39
-4
lines changed
3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ RUN mkdir ${LOGSTASH_HOME} \
41
41
&& rm -f ${LOGSTASH_PACKAGE} \
42
42
&& groupadd -r logstash \
43
43
&& useradd -r -s /usr/sbin/nologin -d ${LOGSTASH_HOME} -c "Logstash service user" -g logstash logstash \
44
- && chown -R logstash:logstash ${LOGSTASH_HOME} \
45
- && mkdir -p /var/log/logstash /etc/logstash/conf.d
44
+ && mkdir -p /var/log/ logstash /etc/logstash/conf.d \
45
+ && chown -R logstash:logstash ${LOGSTASH_HOME} /var/log/logstash
46
46
47
47
ADD ./logstash-init /etc/init.d/logstash
48
48
RUN sed -i -e 's#^LS_HOME=$#LS_HOME=' $LOGSTASH_HOME'#' /etc/init.d/logstash \
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ stop() {
88
88
echo " $name stop failed; still running."
89
89
else
90
90
echo " $name stopped."
91
+ rm -f $pidfile
91
92
fi
92
93
fi
93
94
}
@@ -114,6 +115,7 @@ force_stop() {
114
115
if status; then
115
116
stop
116
117
status && kill -KILL $( cat " $pidfile " )
118
+ rm -f $pidfile
117
119
fi
118
120
}
119
121
Original file line number Diff line number Diff line change 3
3
# /usr/local/bin/start.sh
4
4
# Start Elasticsearch, Logstash and Kibana services
5
5
#
6
+ # spujadas 2015-10-09; added initial pidfile removal and graceful termination
7
+
8
+ # WARNING - This script assumes that the ELK services are not running, and is
9
+ # only expected to be run once, when the container is started.
10
+ # Do not attempt to run this script if the ELK services are running (or be
11
+ # prepared to reap zombie processes).
12
+
13
+
14
+ # # handle termination gracefully
15
+
16
+ _term () {
17
+ echo " Terminating ELK"
18
+ service elasticsearch stop
19
+ service logstash stop
20
+ service kibana stop
21
+ exit 0
22
+ }
23
+
24
+ trap _term SIGTERM
25
+
26
+
27
+ # # remove pidfiles in case previous graceful termination failed
28
+ # NOTE - This is the reason for the WARNING at the top - it's a bit hackish,
29
+ # but if it's good enough for Fedora (https://goo.gl/88eyXJ), it's good
30
+ # enough for me :)
31
+
32
+ rm -f /var/run/elasticsearch/elasticsearch.pid /var/run/logstash.pid \
33
+ /var/run/kibana4.pid
34
+
35
+
36
+ # # start services
6
37
7
38
service elasticsearch start
8
39
service logstash start
9
40
10
- # wait for elasticsearch to start up - https://github.com/elasticsearch/kibana/issues/3077
41
+ # wait for elasticsearch to start up
42
+ # - https://github.com/elasticsearch/kibana/issues/3077
11
43
counter=0
12
44
while [ ! " $( curl localhost:9200 2> /dev/null) " -a $counter -lt 30 ]; do
13
45
sleep 1
17
49
18
50
service kibana start
19
51
20
- tail -f /var/log/elasticsearch/elasticsearch.log
52
+ tail -f /var/log/elasticsearch/elasticsearch.log &
53
+ wait
You can’t perform that action at this time.
0 commit comments