-
Notifications
You must be signed in to change notification settings - Fork 1
/
dmon-stop.sh
executable file
·45 lines (39 loc) · 1.12 KB
/
dmon-stop.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
#!/bin/bash
ARCH=`uname -s`
DIR=
if [ $ARCH == "Linux" ]; then
DIR=`readlink -f "$( dirname "$0" )"`
elif [ $ARCH == "Darwin" ]; then
CMD="import os, sys; print os.path.realpath(\"$( dirname $0 )\")"
DIR=`python -c "$CMD"`
fi
echo "Stopping Kibana ..."
if [ ! -f $DIR/src/pid/kibana.pid ]; then
echo "No Kibana instance to stop."
else
kill -15 `cat $DIR/src/pid/kibana.pid`
rm -rf $DIR/src/pid/kibana.pid
echo "Kibana Stopped!"
fi
echo "Stopping Logstash Server ..."
if [ ! -f $DIR/src/pid/logstash.pid ]; then
echo "No Logstash instance to stop."
else
kill -9 `cat $DIR/src/pid/logstash.pid`
LSPID=`cat $DIR/src/pid/logstash.pid`
sleep 5
kill -9 $(($LSPID+1)) #TODO: fix this, kill by child process
rm -rf $DIR/src/pid/logstash.pid
echo "Logstash Stopped!"
fi
echo "Stopping ElasticSearch ..."
if [ ! -f $DIR/src/pid/elasticsearch.pid ]; then
echo "No ElasticSearch instance to stop."
else
kill -15 `cat $DIR/src/pid/elasticsearch.pid`
rm -rf $DIR/src/pid/elasticsearch.pid
echo "ElasticSearch Stopped!"
fi
echo "Stopping D-Mon"
killall -15 python #TODO need more elegant solution
echo "D-Mon Stopped!"