Files
AidsMonitoring/Iniciar.vbs
T

33 lines
1.3 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
MsgBox "AidsMonitoring ya esta corriendo en el puerto 5503.", 64, "AidsMonitoring"
WScript.Quit
End If
' Uvicorn via pythonw — redirige stdout/stderr al log
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 2500
Set oExec = oShell.Exec("cmd /c netstat -aon | findstr :5503 | findstr LISTENING")
sOut = oExec.StdOut.ReadAll()
If Len(Trim(sOut)) > 0 Then
MsgBox "AidsMonitoring iniciado correctamente." & vbCrLf & vbCrLf & _
"URL: http://localhost:5503" & vbCrLf & _
"Tailscale: http://100.96.43.86:5503", 64, "AidsMonitoring"
Else
MsgBox "El servidor tardo en iniciar. Revisa logs\server.log si hay errores.", 48, "AidsMonitoring"
End If