Publish Nightwing Muninn health over RUDP
This commit is contained in:
parent
789ef4a76d
commit
176353db3e
8 changed files with 99 additions and 28 deletions
|
|
@ -6,12 +6,13 @@ param(
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptPath = Join-Path $PSScriptRoot "nightwing-claim-usb-moves.sh"
|
||||
$sshExe = Join-Path $env:SystemRoot "System32\OpenSSH\ssh.exe"
|
||||
$remoteArgs = ""
|
||||
if (-not [string]::IsNullOrWhiteSpace($HostAddress)) {
|
||||
$remoteArgs = " " + ($HostAddress -replace "'", "'\''")
|
||||
}
|
||||
|
||||
$command = 'ssh.exe -o BatchMode=yes -o ConnectTimeout=5 ' +
|
||||
$command = '"' + $sshExe + '" -o BatchMode=yes -o ConnectTimeout=5 ' +
|
||||
$SshTarget +
|
||||
' "sh -s' +
|
||||
$remoteArgs +
|
||||
|
|
|
|||
|
|
@ -5,7 +5,8 @@ param(
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptPath = Join-Path $PSScriptRoot "nightwing-move-state-sources.sh"
|
||||
$command = 'ssh.exe -o BatchMode=yes -o ConnectTimeout=5 ' +
|
||||
$sshExe = Join-Path $env:SystemRoot "System32\OpenSSH\ssh.exe"
|
||||
$command = '"' + $sshExe + '" -o BatchMode=yes -o ConnectTimeout=5 ' +
|
||||
$SshTarget +
|
||||
' "sh -s" < "' +
|
||||
$scriptPath +
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@ param(
|
|||
[string] $StorePath = "/home/metacrat/.local/state/gamecult/muninn/muninn.telemetry.cc",
|
||||
[string] $PidPath = "/home/metacrat/.local/state/gamecult/muninn/muninn.pid",
|
||||
[string[]] $MoveState = @(),
|
||||
[int] $IntervalSeconds = 15
|
||||
[int] $IntervalSeconds = 15,
|
||||
[string] $IdunnRudpHealth = "10.77.0.2:17870"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
|
@ -42,7 +43,10 @@ set -- --health \
|
|||
--host nightwing
|
||||
$moveStateSetLines
|
||||
set -- "`$@" \
|
||||
--interval-seconds '$IntervalSeconds'
|
||||
--interval-seconds '$IntervalSeconds' \
|
||||
--idunn-rudp-health '$IdunnRudpHealth' \
|
||||
--idunn-daemon 'nightwing-muninn' \
|
||||
--idunn-health-contract 'muninn.cultnet-rudp-remote-telemetry-and-move-hid'
|
||||
'$MuninnExe' "`$@"
|
||||
"@
|
||||
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ hidraw_for_js() {
|
|||
return 1
|
||||
}
|
||||
|
||||
emit_candidates() {
|
||||
for js in /dev/input/js*; do
|
||||
[ -e "$js" ] || continue
|
||||
props="$(udevadm info -q property -n "$js" 2>/dev/null || true)"
|
||||
|
|
@ -75,5 +76,28 @@ $uevent_text" in
|
|||
id="move-$(basename "$js")"
|
||||
fi
|
||||
|
||||
printf '%s=%s\n' "$id" "$js"
|
||||
score=1
|
||||
case "$uevent_text" in
|
||||
*HID_ID=0005:0000054C:000003D5*) score=2 ;;
|
||||
esac
|
||||
|
||||
printf '%s %s %s\n' "$id" "$score" "$js"
|
||||
done
|
||||
}
|
||||
|
||||
emit_candidates | awk '
|
||||
{
|
||||
id = $1
|
||||
score = $2 + 0
|
||||
path = $3
|
||||
if (!(id in best_score) || score >= best_score[id]) {
|
||||
best_score[id] = score
|
||||
best_path[id] = path
|
||||
}
|
||||
}
|
||||
END {
|
||||
for (id in best_path) {
|
||||
print id "=" best_path[id]
|
||||
}
|
||||
}
|
||||
'
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ $arguments = @(
|
|||
"--swarm-profile", "starfire-local",
|
||||
"--repo-root", $repoRoot,
|
||||
"--store", $storePath,
|
||||
"--rudp-health-bind", "0.0.0.0:17870",
|
||||
"--command-timeout-seconds", "600",
|
||||
"--execute"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue