-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.bat
26 lines (19 loc) · 917 Bytes
/
start.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@echo off
setlocal EnableDelayedExpansion
echo Starting cluster setup...
:: Get array of ports from instances
for /f "tokens=* delims=" %%a in ('powershell -NoProfile -Command "$config = Get-Content -Raw 'config.json' | ConvertFrom-Json; $config.instances.port | ForEach-Object { Write-Output $_ }"') do (
echo Processing port: %%a
:: Update only the top-level port
powershell -NoProfile -Command "$config = Get-Content -Raw 'config.json' | ConvertFrom-Json; $config.port = [int]'%%a'; $config | ConvertTo-Json -Depth 10 | Set-Content 'config.json'"
:: Start the instance
echo Starting cargo for port %%a
start "Cargo Instance %%a" cmd /c "cargo run"
:: Wait a bit before starting next instance
timeout /t 5 /nobreak > nul
)
echo.
echo Cluster setup complete. Instances are running in separate windows.
echo Use Task Manager to view running processes.
echo.
endlocal