add sh command to kill gui

This commit is contained in:
Francesco Grazioso 2024-05-11 12:11:26 +02:00
parent f45c0ed26c
commit ceda43658d
2 changed files with 29 additions and 2 deletions

2
.gitignore vendored
View File

@ -64,5 +64,3 @@ venv.bak/
# Other
Video
.idea/
# kill_django.sh is a script to kill the Django server only for developement purposes
kill_django.sh

29
kill_gui.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# Trova i processi che utilizzano la porta 8000
PROCESSES=$(lsof -i :8000 | awk 'NR!=1 {print $2}')
# Termina i processi trovati
if [ -n "$PROCESSES" ]; then
echo "Terminating processes using port 8000:"
for PID in $PROCESSES; do
echo "Killing process with PID: $PID"
kill -9 $PID
done
else
echo "No processes found using port 8000"
fi
# Trova i processi che utilizzano la porta 5173
PROCESSES=$(lsof -i :5173 | awk 'NR!=1 {print $2}')
# Termina i processi trovati
if [ -n "$PROCESSES" ]; then
echo "Terminating processes using port 8000:"
for PID in $PROCESSES; do
echo "Killing process with PID: $PID"
kill -9 $PID
done
else
echo "No processes found using port 8000"
fi