-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop.bash
More file actions
29 lines (24 loc) · 744 Bytes
/
stop.bash
File metadata and controls
29 lines (24 loc) · 744 Bytes
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
#!/bin/bash
# This script will end the ELK Stack if the stack is already running
# Reference on using pgrep: https://man7.org/linux/man-pages/man1/pgrep.1.html
# Check if Elasticsearch is running
if pgrep -x "java -Xms1g -Xmx1g" > /dev/null; then
echo "Stopping Elasticsearch..."
sudo docker stop elasticsearch
fi
# Check if Kibana is running
if pgrep -x "node" > /dev/null; then
echo "Stopping Kibana..."
sudo docker stop kibana
fi
# Check if Logstash is running
if pgrep -x "java -Xms2g -Xmx2g" > /dev/null; then
echo "Stopping Logstash..."
sudo docker stop logstash
fi
# Check if Beats are running
if pgrep -x "beats" > /dev/null; then
echo "Stopping Beats..."
sudo docker stop filebeat
sudo docker stop metricbeat
fi