' Inicia MarineInvoice y MarineMaintenance en segundo plano 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") ' ── 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 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 End If WScript.Sleep 2000 ' ── Verificar ambos ────────────────────────────────────────────────────────── Dim ok1, ok2 Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5000 | findstr LISTENING") ok1 = Len(Trim(oExec.StdOut.ReadAll())) > 0 Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5500 | findstr LISTENING") ok2 = 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 MsgBox sMsg, 64, "Servidores Marinos"