-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop.sh
executable file
·50 lines (38 loc) · 1.15 KB
/
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
46
47
48
#! /bin/bash
# first docker compose down
docker-compose down
# then check if there is a process running on port 5000. If yes, kill it.
# Get the PIDs of processes running on port 5000
PIDs=$(lsof -t -i:5000)
# If processes are found, kill them
if [ -n "$PIDs" ]; then
for PID in $PIDs; do
kill -9 $PID
echo "Killed backend process $PID running on port 5000."
done
else
echo "No backend process found running on port 5000."
fi
# then check if there is a process running on port 8086. If yes, kill it.
# Get the PIDs of processes running on port 8086
PIDs=$(lsof -t -i:8086)
# If processes are found, kill them
if [ -n "$PIDs" ]; then
for PID in $PIDs; do
kill -9 $PID
echo "Killed frontend process $PID running on port 8086."
done
else
echo "No frontend process found running on port 8086."
fi
# Get the PIDs of processes running on port 80
PIDs=$(lsof -t -i:80)
# If processes are found, kill them
if [ -n "$PIDs" ]; then
for PID in $PIDs; do
kill -9 $PID
echo "Killed frontend process $PID running on port 80."
done
else
echo "No frontend process found running on port 80."
fi