-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.ps1
More file actions
22 lines (19 loc) · 943 Bytes
/
Copy pathstart.ps1
File metadata and controls
22 lines (19 loc) · 943 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# NetDash — uruchom / zrestartuj serwer
$ErrorActionPreference = "Stop"
$Port = if ($env:NETDASH_LISTEN_PORT) { [int]$env:NETDASH_LISTEN_PORT } else { 18787 }
$Root = Split-Path -Parent $MyInvocation.MyCommand.Path
$Python = "C:\Users\Admin\AppData\Local\Programs\Python\Python312\python.exe"
Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue |
Select-Object -ExpandProperty OwningProcess -Unique |
ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
Start-Sleep -Seconds 1
Set-Location $Root
Start-Process -FilePath $Python -ArgumentList "run.py" -WorkingDirectory $Root -WindowStyle Normal
Start-Sleep -Seconds 4
try {
$health = Invoke-RestMethod "http://127.0.0.1:$Port/api/health" -TimeoutSec 15
Write-Host "NetDash OK v$($health.version) -> http://127.0.0.1:$Port" -ForegroundColor Green
} catch {
Write-Host "NetDash nie odpowiada na porcie $Port" -ForegroundColor Red
exit 1
}