15 lines
945 B
PowerShell
15 lines
945 B
PowerShell
|
|
[Console]::OutputEncoding = [Text.Encoding]::UTF8
|
||
|
|
Set-ExecutionPolicy -Scope Process Bypass -Force
|
||
|
|
Import-Module Posh-SSH
|
||
|
|
$sec = ConvertTo-SecureString "0" -AsPlainText -Force
|
||
|
|
$cred = New-Object PSCredential("tonycao", $sec)
|
||
|
|
$s = New-SSHSession -ComputerName 192.168.58.7 -Credential $cred -AcceptKey -ConnectionTimeout 15
|
||
|
|
# restart butler WITHOUT relay arg (local AERE answers)
|
||
|
|
$r = Invoke-SSHCommand -SSHSession $s -Command "pkill -f 'enet-validator device'; sleep 1; cd ~/enet-validator && nohup ./target/release/enet-validator device 192.168.58.7 00161cf12e88 300 > ~/butler.log 2>&1 & sleep 2; pgrep -af 'enet-validator device'"
|
||
|
|
Write-Host ($r.Output -join "`n")
|
||
|
|
Write-Host "--- waiting 75s for host re-claim ---"
|
||
|
|
Start-Sleep -Seconds 75
|
||
|
|
$r = Invoke-SSHCommand -SSHSession $s -Command "grep -cE 'AECH' ~/butler.log; echo '---'; grep -E 'AECH|DMX #' ~/butler.log | head -12"
|
||
|
|
Write-Host ($r.Output -join "`n")
|
||
|
|
Remove-SSHSession $s | Out-Null
|