29 lines
1.0 KiB
Plaintext
29 lines
1.0 KiB
Plaintext
' AidsMonitoring — Inicia servidor uvicorn en segundo plano (sin ventana)
|
|
Option Explicit
|
|
Dim oShell, sBackend, sPython, sLog
|
|
|
|
sBackend = "C:\AidsMonitoring\backend"
|
|
sPython = "C:\Users\aerom\AppData\Local\Python\pythoncore-3.14-64\pythonw.exe"
|
|
sLog = "C:\AidsMonitoring\logs\server.log"
|
|
|
|
Set oShell = CreateObject("WScript.Shell")
|
|
|
|
Dim oExec, sOut
|
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5503 | findstr LISTENING")
|
|
sOut = oExec.StdOut.ReadAll()
|
|
If Len(Trim(sOut)) > 0 Then
|
|
oShell.Run "http://localhost:5503", 1, False
|
|
WScript.Quit
|
|
End If
|
|
|
|
oShell.Run "cmd /c cd /d """ & sBackend & """ && """ & sPython & """ -m uvicorn main:app --host 0.0.0.0 --port 5503 >> """ & sLog & """ 2>&1", 0, False
|
|
WScript.Sleep 3000
|
|
|
|
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5503 | findstr LISTENING")
|
|
sOut = oExec.StdOut.ReadAll()
|
|
If Len(Trim(sOut)) > 0 Then
|
|
oShell.Run "http://localhost:5503", 1, False
|
|
Else
|
|
MsgBox "El servidor no respondio. Revisa logs\server.log", 48, "AidsMonitoring"
|
|
End If
|