feat: Update server scripts to use root path for HTTP transport and add process management scripts

This commit is contained in:
2025-06-22 11:50:54 +02:00
parent fa33321ff1
commit 58238a5918
6 changed files with 109 additions and 3 deletions
+34
View File
@@ -0,0 +1,34 @@
import os
import signal
import time
PID_FILE = "mcps.pid"
def cerrar_procesos(pid_file):
if not os.path.exists(pid_file):
print(f"❌ No se encontró el archivo {pid_file}")
return
with open(pid_file, "r") as f:
pids = [line.strip() for line in f if line.strip().isdigit()]
for pid_str in pids:
pid = int(pid_str)
try:
os.kill(pid, signal.SIGTERM)
print(f"✔ Proceso {pid} terminado con SIGTERM.")
except ProcessLookupError:
print(f"⚠ El proceso {pid} no existe o ya fue terminado.")
except PermissionError:
print(f"❌ No tienes permiso para terminar el proceso {pid}.")
except Exception as e:
print(f"❌ Error al cerrar el proceso {pid}: {e}")
try:
os.remove(pid_file)
print(f"🧹 Archivo {pid_file} eliminado.")
except Exception as e:
print(f"⚠ No se pudo eliminar {pid_file}: {e}")
if __name__ == "__main__":
cerrar_procesos(PID_FILE)