Skip to main content
Version: 2026.07.11

Reliable Service Operations (Restart-GriffService.ps1)

One idempotent tool for starting/stopping/restarting registered platform services, and the intended backend for UI command buttons.

Location: 00_MISSION_CONTROL/service-ops/Restart-GriffService.ps1 (+ griff-service-registry.json, README.md).

Usage

pwsh -NoProfile -File .\Restart-GriffService.ps1 -Action status -Service all
pwsh -NoProfile -File .\Restart-GriffService.ps1 -Action restart -Service Brain-MCP
pwsh -NoProfile -File .\Restart-GriffService.ps1 -Action start -Service Brain-HTTP -Json

-Action: status · start · stop · restart. -Service: a registry key (Brain-MCP, Brain-HTTP) or all. -Json emits machine output.

Guarantees

  • Ends the scheduled task, clears residual port holders, starts the task once, waits for the listener/health probe, and reports task action alignment.
  • Uses schtasks.exe, TCP listener checks, and HTTP probes.
  • Writes a JSON receipt per op to 06_SESSION_EVIDENCE/receipts/.

-Json shape (for UI buttons)

{ "ok": true, "action": "restart", "service": "Brain-MCP",
"results": [ { "service":"Brain-MCP", "manager":"schtask",
"taskName":"\\GRIFF-Brain-MCP", "taskActionOk":true,
"post": { "taskState":"Running", "healthy":true },
"port":8788, "servesFrom":"service entrypoint ...; runtime code ..." } ] }

Add a new service (no code edit)

Add an entry under services in griff-service-registry.json: manager, taskName, bindHost, port, expectedCmd (unique substring of the worker command line), startScript, healthKind (http/mcp), healthUrl, optional tunnel metadata. It is immediately manageable and button-ready.

UI buttons (planned)

The desktop control plane will expose Status / Start / Stop / Restart buttons per service, each shelling this tool with -Json and rendering taskState, portOwnerPid, healthy, taskActionOk, and the receipt link.