Files
Flamenco-Management/old/cmd_run_flamenco_workers.ps1
2025-07-15 12:25:23 -06:00

59 lines
2.5 KiB
PowerShell

# Unified Flamenco Worker Connection Script (CMD VERSION)
Write-Host "====================================" -ForegroundColor Cyan
Write-Host " FLAMENCO CMD WORKER LAUNCHER" -ForegroundColor Cyan
Write-Host "====================================" -ForegroundColor Cyan
Write-Host
# Define available systems
$systems = @(
@{ ID = 1; Name = "masterbox"; ScriptPath = "run_masterbox_cmd.ps1"; BatchPath = "run_masterbox_cmd.bat" },
@{ ID = 2; Name = "i9-13ks"; ScriptPath = "run_i9-13ks_cmd.ps1"; BatchPath = "run_i9-13ks_cmd.bat" },
@{ ID = 3; Name = "max"; ScriptPath = "run_max_cmd.ps1"; BatchPath = "run_max_cmd.bat" },
@{ ID = 4; Name = "echo"; ScriptPath = "run_echo_cmd.ps1"; BatchPath = "run_echo_cmd.bat" },
@{ ID = 5; Name = "blender-boss"; ScriptPath = "run_blender-boss_cmd.ps1"; BatchPath = "run_blender-boss_cmd.bat" }
)
# Print menu options
Write-Host "Select a system to connect to (CMD VERSION):" -ForegroundColor Yellow
foreach ($system in $systems) {
Write-Host "$($system.ID). $($system.Name)" -ForegroundColor Green
}
Write-Host "0. Connect to ALL systems (separate windows)" -ForegroundColor Magenta
Write-Host
# Get user selection
$selection = Read-Host "Enter your selection (0-$($systems.Count))"
# Process selection
if ($selection -eq "0") {
# Launch all systems in separate windows
Write-Host "Launching all worker scripts in separate windows..." -ForegroundColor Cyan
foreach ($system in $systems) {
$scriptPath = Join-Path (Get-Location) $system.BatchPath
Start-Process "cmd.exe" -ArgumentList "/c $scriptPath" -WindowStyle Normal
Write-Host "Started $($system.Name) worker in a new window." -ForegroundColor Green
Start-Sleep -Seconds 2 # Add a small delay between launches
}
Write-Host "`nAll worker scripts have been launched." -ForegroundColor Cyan
Write-Host "Each worker is running in its own command window." -ForegroundColor Yellow
}
else {
# Find the selected system
$selectedSystem = $systems | Where-Object { $_.ID -eq [int]$selection }
if ($selectedSystem) {
Write-Host "Launching $($selectedSystem.Name) worker script..." -ForegroundColor Cyan
# Execute the PowerShell script directly
$scriptPath = Join-Path (Get-Location) $selectedSystem.ScriptPath
& $scriptPath
}
else {
Write-Host "Invalid selection. Please run the script again." -ForegroundColor Red
}
}
Write-Host "`nPress Enter to exit..."
$null = Read-Host