-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathentrypoint.sh
93 lines (75 loc) · 2.56 KB
/
entrypoint.sh
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
90
91
92
93
#!/bin/bash
if [ -z "$ES_JAVA_OPTS" ]; then
# if not set just use ES defaults (that were formally in jvm.options see Dockerfile)
export ES_JAVA_OPTS="-Xmx2g -Xms2g"
else
echo
echo "using: ES_JAVA_OPTS=$ES_JAVA_OPTS"
fi
echo
echo "Starting ElasticSearch.... please wait"
echo
su -c "export ES_JAVA_OPTS='$ES_JAVA_OPTS'; nohup /toolbox/elasticsearch/bin/elasticsearch -d -Enetwork.host=0.0.0.0 &>/toolbox/elasticsearch/logs/elasticsearch.log &" -s /bin/bash elasticsearch
sleep 10
timeout 30 tail -f /toolbox/elasticsearch/logs/elasticsearch.log
echo
echo "Starting Kibana....please wait"
echo
su -c "nohup /toolbox/kibana/bin/kibana -c /toolbox/kibana.yml &>/toolbox/kibana/kibana.log &" -s /bin/bash elasticsearch
sleep 5
timeout 30 tail -f /toolbox/kibana/kibana.log
set -e
#command="$1 $2 $3";
command="$1"
script="$2"
if [[ "$command" == "python" && "$script" == "/toolbox/elasticsearch-gmail/src/index_emails.py" ]]; then
echo
echo "Launching MBOX email indexer....";
echo
# launch it!
args=( "$@" )
python2 /toolbox/elasticsearch-gmail/src/index_emails.py ${args[@]:2}
echo ""
echo "MBOX email indexing is complete!"
echo ""
elif [[ "$command" == "python" && "$script" == "/toolbox/csv2es/csv2es.py" ]]; then
echo
echo "Launching CSV indexer....";
echo
args=( "$@" )
python2 /toolbox/csv2es/csv2es.py ${args[@]:2}
echo ""
echo "CSV indexing is complete!"
echo ""
elif [[ "$command" == "analyze-only" ]]; then
echo
echo "System started in analyze-only mode";
echo
else
echo
echo "WARN: You should start with one of the following commands: "
echo " 1. 'python /toolbox/elasticsearch-gmail/src/index_emails.py'";
echo " 2. 'python /toolbox/csv2es/csv2es.py'";
echo " 2. 'analyze-only' (default)";
echo
echo "System started in analyze-only mode";
echo
fi
echo
echo "ElasticSearch and Kibana processes....."
ps aux | grep 'java\|kibana'
echo
echo
echo "In your web browser go to http://localhost:5601"
echo ""
echo "On the first screen that says 'Configure an index pattern', in the field labeled 'Index name or pattern' type 'mbox'"
echo "you will then see the 'date_ts' field auto-selected, then hit the 'Create' button. From there Kibana is ready to use!"
echo ""
echo "Kibana 5 tutorial: https://www.youtube.com/watch?v=mMhnGjp8oOI"
echo ""
echo "Note: if running docker toolbox; 'localhost' above might not work, execute a 'docker-machine env default'"
echo "to determine your docker hosts IP address, then go to http://[machine-ip]:5601"
echo
echo "To quit the entire engine type ^C (cntrl C)"
echo ""
while true; do sleep 60; done