From e0e01d7c5586d80789df2bf22d3fa922fcd58702 Mon Sep 17 00:00:00 2001 From: aerom Date: Tue, 5 May 2026 02:34:49 -0400 Subject: [PATCH] Update Iniciar_Ambos: add fleet-management, AidsMonitoring, AR ECDIS --- Iniciar_Ambos.vbs | 88 +++++++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 29 deletions(-) diff --git a/Iniciar_Ambos.vbs b/Iniciar_Ambos.vbs index 4074e47..c3417a2 100644 --- a/Iniciar_Ambos.vbs +++ b/Iniciar_Ambos.vbs @@ -1,51 +1,81 @@ -' Inicia MarineInvoice y MarineMaintenance en segundo plano +' ============================================================ +' LANZADOR GLOBAL — Inicia todos los servidores en background +' MarineInvoice (5000) | MarineMaintenance (5500) +' fleet-management (5010) | AidsMonitoring (5503) +' AR ECDIS (app Qt, sin puerto) +' ============================================================ Option Explicit Dim oShell -Dim sPython -Dim sLog1, sLog2 - -sPython = "C:\Users\aerom\AppData\Local\Python\pythoncore-3.14-64\pythonw.exe" -sLog1 = "C:\MarineInvoice\logs\server.log" -sLog2 = "C:\MarineMaintenance\logs\server.log" - Set oShell = CreateObject("WScript.Shell") +Dim sPyGlobal, sLog +sPyGlobal = "C:\Users\aerom\AppData\Local\Python\pythoncore-3.14-64\pythonw.exe" + ' ── MarineInvoice (5000) ────────────────────────────────────────────────────── Dim oExec, sOut Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING") -sOut = oExec.StdOut.ReadAll() -If Len(Trim(sOut)) = 0 Then - oShell.Run "cmd /c cd /d ""C:\MarineInvoice"" && """ & sPython & """ app.py >> """ & sLog1 & """ 2>&1", 0, False +If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then + sLog = "C:\MarineInvoice\logs\server.log" + oShell.Run "cmd /c cd /d ""C:\MarineInvoice"" && """ & sPyGlobal & """ app.py >> """ & sLog & """ 2>&1", 0, False End If ' ── MarineMaintenance (5500) ───────────────────────────────────────────────── Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5500 | findstr LISTENING") -sOut = oExec.StdOut.ReadAll() -If Len(Trim(sOut)) = 0 Then - oShell.Run "cmd /c cd /d ""C:\MarineMaintenance"" && """ & sPython & """ app.py >> """ & sLog2 & """ 2>&1", 0, False +If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then + sLog = "C:\MarineMaintenance\logs\server.log" + oShell.Run "cmd /c cd /d ""C:\MarineMaintenance"" && """ & sPyGlobal & """ app.py >> """ & sLog & """ 2>&1", 0, False End If -WScript.Sleep 2000 +' ── Fleet Management (5010) ────────────────────────────────────────────────── +Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5010 | findstr LISTENING") +If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then + sLog = "C:\fleet-management\logs\server.log" + oShell.Run "cmd /c cd /d ""C:\fleet-management"" && ""C:\fleet-management\venv\Scripts\pythonw.exe"" run.py >> """ & sLog & """ 2>&1", 0, False +End If -' ── Verificar ambos ────────────────────────────────────────────────────────── -Dim ok1, ok2 +' ── AidsMonitoring (5503) ──────────────────────────────────────────────────── +Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5503 | findstr LISTENING") +If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then + sLog = "C:\AidsMonitoring\logs\server.log" + oShell.Run "cmd /c cd /d ""C:\AidsMonitoring\backend"" && """ & sPyGlobal & """ -m uvicorn main:app --host 0.0.0.0 --port 5503 >> """ & sLog & """ 2>&1", 0, False +End If + +' ── AR ECDIS (app Qt — sin puerto) ─────────────────────────────────────────── +Dim sEcdisDir, sEcdisPy +sEcdisDir = "D:\Proyectos Software\AR ECDIS\webecdis" +sEcdisPy = sEcdisDir & "\venv\Scripts\pythonw.exe" +' Solo lanzar si no hay instancia corriendo +Set oExec = oShell.Exec("cmd /c tasklist | findstr /i pythonw.exe | findstr /i webecdis") +If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then + oShell.CurrentDirectory = sEcdisDir + oShell.Run """" & sEcdisPy & """ """ & sEcdisDir & "\main.py""", 0, False +End If + +' ── Esperar y verificar servidores web ─────────────────────────────────────── +WScript.Sleep 3000 + +Dim ok0, ok1, ok2, ok3 Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING") -ok1 = Len(Trim(oExec.StdOut.ReadAll())) > 0 - +ok0 = Len(Trim(oExec.StdOut.ReadAll())) > 0 Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5500 | findstr LISTENING") +ok1 = Len(Trim(oExec.StdOut.ReadAll())) > 0 +Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5010 | findstr LISTENING") ok2 = Len(Trim(oExec.StdOut.ReadAll())) > 0 +Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5503 | findstr LISTENING") +ok3 = Len(Trim(oExec.StdOut.ReadAll())) > 0 Dim sMsg sMsg = "Estado de servidores:" & vbCrLf & vbCrLf -If ok1 Then - sMsg = sMsg & "OK MarineInvoice -> http://localhost:5000" & vbCrLf -Else - sMsg = sMsg & "ERR MarineInvoice -> no respondio (ver logs)" & vbCrLf -End If -If ok2 Then - sMsg = sMsg & "OK MarineMaintenance -> http://localhost:5500" & vbCrLf -Else - sMsg = sMsg & "ERR MarineMaintenance -> no respondio (ver logs)" & vbCrLf -End If + +If ok0 Then sMsg = sMsg & "OK MarineInvoice -> http://localhost:5000" & vbCrLf _ + Else sMsg = sMsg & "ERR MarineInvoice -> no respondio" & vbCrLf +If ok1 Then sMsg = sMsg & "OK MarineMaintenance -> http://localhost:5500" & vbCrLf _ + Else sMsg = sMsg & "ERR MarineMaintenance -> no respondio" & vbCrLf +If ok2 Then sMsg = sMsg & "OK Fleet Management -> http://localhost:5010" & vbCrLf _ + Else sMsg = sMsg & "ERR Fleet Management -> no respondio" & vbCrLf +If ok3 Then sMsg = sMsg & "OK AidsMonitoring -> http://localhost:5503" & vbCrLf _ + Else sMsg = sMsg & "ERR AidsMonitoring -> no respondio" & vbCrLf + +sMsg = sMsg & vbCrLf & "AR ECDIS lanzado (ventana independiente)" MsgBox sMsg, 64, "Servidores Marinos"