88 lines
4.9 KiB
Plaintext
88 lines
4.9 KiB
Plaintext
' ============================================================
|
|
' 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
|
|
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")
|
|
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")
|
|
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
|
|
|
|
' ── 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
|
|
|
|
' ── 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")
|
|
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 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"
|
|
|
|
' Abrir browser para cada servidor que respondio
|
|
If ok0 Then oShell.Run "http://localhost:5000", 1, False
|
|
If ok1 Then oShell.Run "http://localhost:5500", 1, False
|
|
If ok2 Then oShell.Run "http://localhost:5010", 1, False
|
|
If ok3 Then oShell.Run "http://localhost:5503", 1, False
|