-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstop-all.sh
More file actions
53 lines (36 loc) · 1.39 KB
/
Copy pathstop-all.sh
File metadata and controls
53 lines (36 loc) · 1.39 KB
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
#!/bin/bash
#pideureka=$(ps aux | grep eureka-service | grep -v grep | awk '{print $2}')
#kill -9 $pideureka
#pidauth=$(ps aux | grep auth-service | grep -v grep | awk '{print $2}')
#kill -9 $pidauth
#pidprod=$(ps aux | grep product-service | grep -v grep | awk '{print $2}')
#kill -9 $pidprod
#pidorder=$(ps aux | grep order-service | grep -v grep | awk '{print $2}')
#kill -9 $pidorder
#pidgateway=$(ps aux | grep gateway-service | grep -v grep | awk '{print $2}')
#kill -9 $pidgateway
# Função para matar os processos dos serviços
stop_service() {
# Filtra os processos relacionados ao serviço pelo nome do JAR
local service_name=$1
echo "Parando o serviço $service_name..."
# Encontra os processos relacionados ao JAR e os mata
pid=$(ps aux | grep "$service_name" | grep -v grep | awk '{print $2}')
if [ -n "$pid" ]; then
kill -9 $pid
echo "$service_name parado com sucesso!"
else
echo "Nenhum processo encontrado para $service_name."
fi
}
# Parar o Eureka
stop_service "eureka-service-0.0.1-SNAPSHOT.jar"
# Parar o Auth Service
stop_service "auth-service-0.0.1-SNAPSHOT.jar"
# Parar o Product Service
stop_service "product-service-0.0.1-SNAPSHOT.jar"
# Parar o Order Service
stop_service "order-service-0.0.1-SNAPSHOT.jar"
# Parar o Gateway Service
stop_service "gateway-service-0.0.1-SNAPSHOT.jar"
echo "Todos os serviços foram parados!"