This repository was archived by the owner on Jun 19, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStop-FlashWoW.ps1
More file actions
39 lines (34 loc) · 2.17 KB
/
Copy pathStop-FlashWoW.ps1
File metadata and controls
39 lines (34 loc) · 2.17 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
# Stop-FlashWoW.ps1 - graceful shutdown: matrix children first, then world via
# SOAP 'server shutdown' (clean bot saves), auth, mysqld last.
[CmdletBinding()]
param([switch]$Force)
$MysqlBin = 'C:\Program Files\MySQL\MySQL Server 8.4\bin'
function Write-Stage([string]$Msg) { Write-Host ("[{0}] {1}" -f (Get-Date -Format 'HH:mm:ss'), $Msg) }
# 1. matrix (supervisor + its python children)
$pythons = Get-CimInstance Win32_Process -Filter "Name='python.exe'" | Where-Object { $_.CommandLine -match 'matrix' }
foreach ($p in $pythons) { Write-Stage "stopping matrix pid $($p.ProcessId)"; Stop-Process -Id $p.ProcessId -Force -ErrorAction SilentlyContinue }
# 2. worldserver - graceful via SOAP (saves all bots/characters cleanly)
if (Get-Process worldserver -ErrorAction SilentlyContinue) {
Write-Stage 'asking worldserver to shut down gracefully (SOAP)...'
try {
Import-Module 'C:\FlashWoW\Tools\proof\FWProof.psm1' -Force
$r = Invoke-FWSoap -Command 'server shutdown 5' -TimeoutSec 30
Write-Stage "SOAP: $($r.result)"
} catch { Write-Stage "SOAP unavailable: $($_.Exception.Message)" }
foreach ($i in 1..24) { Start-Sleep 5; if (-not (Get-Process worldserver -ErrorAction SilentlyContinue)) { break } }
if (Get-Process worldserver -ErrorAction SilentlyContinue) {
if ($Force) { Write-Stage 'force-killing worldserver'; Stop-Process -Name worldserver -Force }
else { Write-Stage 'worldserver still up after 120s - rerun with -Force to kill'; exit 1 }
}
}
Write-Stage 'worldserver stopped'
# 3. authserver
Get-Process authserver -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
Write-Stage 'authserver stopped'
# 4. mysqld - clean shutdown so InnoDB closes consistent
if (Get-Process mysqld -ErrorAction SilentlyContinue) {
cmd /c """$MysqlBin\mysqladmin.exe"" --host=127.0.0.1 -u root shutdown 2>&1" | Out-Null
foreach ($i in 1..15) { Start-Sleep 2; if (-not (Get-Process mysqld -ErrorAction SilentlyContinue)) { break } }
if (Get-Process mysqld -ErrorAction SilentlyContinue) { Write-Stage 'mysqld still up; leaving it (data-safe)' } else { Write-Stage 'mysqld stopped' }
}
Write-Stage 'FlashWoW stack down'