@echo off :: Executar como Administrador net session >nul 2>&1 if %errorLevel% neq 0 ( powershell -Command "Start-Process '%~f0' -Verb RunAs" exit ) echo Instalando servico Dashboard DEVSYS... :: Remover servico antigo se existir sc stop DashboardDEVSYS >nul 2>&1 sc delete DashboardDEVSYS >nul 2>&1 sc stop TunelDEVSYS >nul 2>&1 sc delete TunelDEVSYS >nul 2>&1 :: Instalar NSSM se nao tiver where nssm >nul 2>&1 if %errorLevel% neq 0 ( echo Baixando NSSM... powershell -Command "Invoke-WebRequest -Uri 'https://nssm.cc/release/nssm-2.24.zip' -OutFile '%TEMP%\nssm.zip'; Expand-Archive '%TEMP%\nssm.zip' -DestinationPath '%TEMP%\nssm' -Force; Copy-Item '%TEMP%\nssm\nssm-2.24\win64\nssm.exe' 'C:\Windows\System32\nssm.exe'" ) :: Criar servico do servidor Python nssm install DashboardDEVSYS python "D:\Evolução categorias\.worktrees\comissao\servidor.py" nssm set DashboardDEVSYS AppDirectory "D:\Evolução categorias\.worktrees\comissao" nssm set DashboardDEVSYS DisplayName "Dashboard DEVSYS - Estoque" nssm set DashboardDEVSYS Description "Servidor HTTP do Dashboard de Estoque DEVSYS" nssm set DashboardDEVSYS Start SERVICE_AUTO_START nssm set DashboardDEVSYS AppRestartDelay 3000 nssm set DashboardDEVSYS AppStdout "D:\Evolução categorias\.worktrees\comissao\servidor.log" nssm set DashboardDEVSYS AppStderr "D:\Evolução categorias\.worktrees\comissao\servidor_err.log" :: Criar servico do Cloudflare Tunnel nssm install TunelDEVSYS cloudflared tunnel --config "C:\Users\Claudio\.cloudflared\dashboard-estoque.yml" run dashboard-estoque nssm set TunelDEVSYS DisplayName "Tunel Cloudflare - Dashboard DEVSYS" nssm set TunelDEVSYS Start SERVICE_AUTO_START nssm set TunelDEVSYS AppRestartDelay 5000 :: Iniciar servicos sc start DashboardDEVSYS sc start TunelDEVSYS echo. echo ============================================= echo Servicos instalados e iniciados! echo Dashboard: http://192.168.0.115:5657/dashboard_estoque.html echo Online: https://silvalarestoque.org/dashboard_estoque.html echo ============================================= pause