EEGFrontier/Pendulum/stop_reflex.ps1
TheusHen 52c98dcdfa Add EEG processing and visualization components
- Implemented mne_tools.py for converting sample records to MNE Raw format.
- Created models.py to define data structures for sample, event, and error packets.
- Developed pyqt_focus.py for a PyQt-based focus monitoring GUI with real-time EEG data visualization.
- Added 
eflex_bridge.py to manage the EEG engine instance.
- Introduced simulator.py to simulate EEG data packets for testing purposes.
- Established a web dashboard in pendulum_web.py for live EEG data display and diagnostics.
- Configured project dependencies in pyproject.toml and 
equirements.txt.
- Added batch and PowerShell scripts for running and stopping the Reflex application.
- Created 
xconfig.py for Reflex application configuration.
2026-02-28 17:56:04 -03:00

41 lines
957 B
PowerShell

$ErrorActionPreference = "SilentlyContinue"
$ports = 3000, 8000, 8001
$pids = @()
foreach ($port in $ports) {
$lines = netstat -ano | Select-String ":$port"
foreach ($line in $lines) {
$lineText = $line.ToString()
if ($lineText -notmatch "LISTENING") {
continue
}
$parts = ($lineText -replace "\s+", " ").Trim().Split(" ")
if ($parts.Length -gt 0) {
$pidToken = $parts[-1]
if ($pidToken -match "^\d+$") {
$pidInt = [int]$pidToken
if ($pidInt -ne $PID) {
$pids += $pidInt
}
}
}
}
}
$pids = $pids | Sort-Object -Unique
if (-not $pids -or $pids.Count -eq 0) {
Write-Host "No Reflex-related processes found on ports 3000/8000/8001."
exit 0
}
Write-Host "Stopping PIDs: $($pids -join ', ')"
foreach ($procId in $pids) {
try {
Stop-Process -Id $procId -Force -ErrorAction Stop
Write-Host "Stopped $procId"
} catch {
Write-Host "Skipped $procId"
}
}