-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkill_workspace_servers
More file actions
executable file
·39 lines (30 loc) · 1018 Bytes
/
kill_workspace_servers
File metadata and controls
executable file
·39 lines (30 loc) · 1018 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
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Script to kill vite/node servers running on workspace ports
echo "==================================="
echo "Stopping Workspace Servers"
echo "==================================="
# Define ports used by workspaces
PORTS=(8081 8082 8083)
for port in "${PORTS[@]}"; do
echo "Checking port $port..."
# Find process using the port
PID=$(lsof -ti :$port)
if [ ! -z "$PID" ]; then
# Get process info
PROCESS_INFO=$(ps -p $PID -o comm= 2>/dev/null)
echo " Found process on port $port: $PROCESS_INFO (PID: $PID)"
# Kill the process
kill -9 $PID 2>/dev/null
if [ $? -eq 0 ]; then
echo " ✓ Killed process on port $port"
else
echo " ✗ Failed to kill process on port $port"
fi
else
echo " - No process found on port $port"
fi
done
echo ""
echo "==================================="
echo "Server cleanup complete"
echo "==================================="