Update Iniciar_Ambos: add fleet-management, AidsMonitoring, AR ECDIS

This commit is contained in:
2026-05-05 02:34:49 -04:00
parent 58414331f8
commit e0e01d7c55
+59 -29
View File
@@ -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 Option Explicit
Dim oShell 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") Set oShell = CreateObject("WScript.Shell")
Dim sPyGlobal, sLog
sPyGlobal = "C:\Users\aerom\AppData\Local\Python\pythoncore-3.14-64\pythonw.exe"
' ── MarineInvoice (5000) ────────────────────────────────────────────────────── ' ── MarineInvoice (5000) ──────────────────────────────────────────────────────
Dim oExec, sOut Dim oExec, sOut
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING") Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING")
sOut = oExec.StdOut.ReadAll() If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then
If Len(Trim(sOut)) = 0 Then sLog = "C:\MarineInvoice\logs\server.log"
oShell.Run "cmd /c cd /d ""C:\MarineInvoice"" && """ & sPython & """ app.py >> """ & sLog1 & """ 2>&1", 0, False oShell.Run "cmd /c cd /d ""C:\MarineInvoice"" && """ & sPyGlobal & """ app.py >> """ & sLog & """ 2>&1", 0, False
End If End If
' ── MarineMaintenance (5500) ───────────────────────────────────────────────── ' ── MarineMaintenance (5500) ─────────────────────────────────────────────────
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5500 | findstr LISTENING") Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5500 | findstr LISTENING")
sOut = oExec.StdOut.ReadAll() If Len(Trim(oExec.StdOut.ReadAll())) = 0 Then
If Len(Trim(sOut)) = 0 Then sLog = "C:\MarineMaintenance\logs\server.log"
oShell.Run "cmd /c cd /d ""C:\MarineMaintenance"" && """ & sPython & """ app.py >> """ & sLog2 & """ 2>&1", 0, False oShell.Run "cmd /c cd /d ""C:\MarineMaintenance"" && """ & sPyGlobal & """ app.py >> """ & sLog & """ 2>&1", 0, False
End If 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 ────────────────────────────────────────────────────────── ' ── AidsMonitoring (5503) ────────────────────────────────────────────────────
Dim ok1, ok2 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") 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") 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 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 Dim sMsg
sMsg = "Estado de servidores:" & vbCrLf & vbCrLf sMsg = "Estado de servidores:" & vbCrLf & vbCrLf
If ok1 Then
sMsg = sMsg & "OK MarineInvoice -> http://localhost:5000" & vbCrLf If ok0 Then sMsg = sMsg & "OK MarineInvoice -> http://localhost:5000" & vbCrLf _
Else Else sMsg = sMsg & "ERR MarineInvoice -> no respondio" & vbCrLf
sMsg = sMsg & "ERR MarineInvoice -> no respondio (ver logs)" & vbCrLf If ok1 Then sMsg = sMsg & "OK MarineMaintenance -> http://localhost:5500" & vbCrLf _
End If Else sMsg = sMsg & "ERR MarineMaintenance -> no respondio" & vbCrLf
If ok2 Then If ok2 Then sMsg = sMsg & "OK Fleet Management -> http://localhost:5010" & vbCrLf _
sMsg = sMsg & "OK MarineMaintenance -> http://localhost:5500" & vbCrLf Else sMsg = sMsg & "ERR Fleet Management -> no respondio" & vbCrLf
Else If ok3 Then sMsg = sMsg & "OK AidsMonitoring -> http://localhost:5503" & vbCrLf _
sMsg = sMsg & "ERR MarineMaintenance -> no respondio (ver logs)" & vbCrLf Else sMsg = sMsg & "ERR AidsMonitoring -> no respondio" & vbCrLf
End If
sMsg = sMsg & vbCrLf & "AR ECDIS lanzado (ventana independiente)"
MsgBox sMsg, 64, "Servidores Marinos" MsgBox sMsg, 64, "Servidores Marinos"