feat: Implement MCP server generation and process management scripts

This commit is contained in:
2025-06-22 12:34:24 +02:00
parent 58238a5918
commit daebea9e9c
4 changed files with 74 additions and 20 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)