-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathELKup
executable file
·89 lines (74 loc) · 1.97 KB
/
ELKup
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
usage(){
echo "Usage: $0 [start | stop]"
exit 1
}
VERSION=${TAG}
ES_JVM_SIZE="-Xms2g -Xmx2g"
ES_OPTIONS=""
HOME_INSTALL=${ES_INSTALL_HOME}
ES_HOME="${HOME_INSTALL}/${VERSION}/elasticsearch-${VERSION}"
KIB_HOME="${HOME_INSTALL}/${VERSION}/kibana-${VERSION}-darwin-x86_64"
APM_HOME="${HOME_INSTALL}/${VERSION}/apm-server-${VERSION}-darwin-x86_64"
LS_HOME="${HOME_INSTALL}/${VERSION}/logstash-${VERSION}"
# ES_LOGS="/Users/sbrown/workspace/elastic-install/Common/ES/Logs"
# ES_CONF="/Users/sbrown/workspace/elastic-install/Common/ES/Config"
# KIB_LOGS="/Users/sbrown/workspace/elastic-install/Common/KIB/Logs"
# KIB_CONF="/Users/sbrown/workspace/elastic-install/Common/KIB/Config"
if [ $# -ne 1 ]; then
usage
fi
if [ $1 == 'start' ]; then
cd $ES_HOME
if [ ! -f ./pid ] ; then
echo "Starting Elasticsearch ..."
ES_JAVA_OPTS="${ES_JVM_SIZE}" ./bin/elasticsearch -d -p pid ${ES_OPTIONS}
else
PID=`cat pid`
echo "Elasticsearch already running pid=${PID}"
fi
cd $KIB_HOME
if [ ! -f ./pid ] ; then
echo "Starting Kibana ..."
mkdir -p logs
./bin/kibana --logging.dest=./logs/kibana.log & echo $! > pid
else
PID=`cat pid`
echo "Kibana already running pid=${PID}"
fi
cd $APM_HOME
if [ ! -f ./pid ] ; then
echo "Starting APM Server ..."
./apm-server -E "apm-server.rum.enabled=true" & echo $! > pid
else
PID=`cat pid`
echo "APM server already running pid=${PID}"
fi
elif [ $1 == 'stop' ]; then
cd $ES_HOME
if [ -f ./pid ] ; then
echo "Stopping Elasticsearch ..."
kill `cat pid`
# NOTE elasticearch cleans up its own pid file
else
echo "Elasicsearch not running ..."
fi
cd $KIB_HOME
if [ -f ./pid ] ; then
echo "Stopping Kibana ... "
pkill -P `cat pid`
rm pid
else
echo "Kibana not running ..."
fi
cd $APM_HOME
if [ -f ./pid ] ; then
echo "Stopping APM Server ... "
kill `cat pid`
rm pid
else
echo "APM Server not running ..."
fi
else
usage
fi