🚧 Implement service stub
This commit is contained in:
@@ -69,17 +69,34 @@ Legend: **[done]** complete & verified · **[partial]** some of it landed ·
|
||||
(`report/base.py`): per-sink failure isolation, best-effort close. The
|
||||
`run` verb wires console + JSONL + textlog + eventlog (+http when set).
|
||||
|
||||
## Phase 3 — Windows service
|
||||
## Phase 3 — Windows service **[partial]**
|
||||
|
||||
- [todo] 1. `service.py` — `ServiceFramework` host; clean stop
|
||||
(`STOP_PENDING`, join-with-timeout, abandon hung COM thread).
|
||||
- [todo] 2. CLI verbs `install`/`uninstall`/`start`/`stop` (sc.exe semantics).
|
||||
- [todo] 3. SCM recovery (`sc failure ... restart`), auto-start, service
|
||||
account docs.
|
||||
- [todo] 4. `%ProgramData%\OPCDA-Diagnozer\` config/log dir conventions
|
||||
(frozen exe already defaults there).
|
||||
- [open] Frozen-exe SCM hosting: console exe must expose `ServiceMain` — one
|
||||
careful build pass (pywin32 `ServiceControlDispatcher`).
|
||||
- [done] 1. `service.py` — `ServiceFramework` host (monitor thread +
|
||||
poller, `PYS_SERVICE_STARTED/STOPPED` lifecycle entries); clean stop
|
||||
(`STOP_PENDING`, 30 s join-with-timeout, abandon hung COM thread,
|
||||
never joined — verified in-process via the pywin32 debug host against
|
||||
the fake client: start → poll → stop in 0.1 s).
|
||||
- [done] 2. CLI verbs `install`/`uninstall`/`start`/`stop`/`status` —
|
||||
actionable error mapping (elevation / not-installed / not-running
|
||||
hints), install validates the config BEFORE touching the SCM, and
|
||||
prints the recorded config path + auto-start/recovery summary.
|
||||
- [done] 3. SCM recovery (`sc failure` semantics) wired at install:
|
||||
restart on first+second failure (5 s delay, 24 h counter reset) via
|
||||
`ChangeServiceConfig2(SERVICE_CONFIG_FAILURE_ACTIONS)` — dict shape
|
||||
verified against pywin32's SWIG parser; auto-start
|
||||
(`SERVICE_AUTO_START`); service-account docs in README (LocalSystem
|
||||
for local servers; `--account`/`--password` for remote DCOM).
|
||||
- [done] 4. `%ProgramData%\OPCDA-Diagnozer\` conventions documented
|
||||
(README deployment layout); config path recorded in the service's
|
||||
registry `Parameters` at install so startup never depends on the
|
||||
service CWD; `install` also registers the Event Log source with its
|
||||
message file (the eventlog reporter's deferred step).
|
||||
- [open] Frozen-exe SCM hosting: the exe self-hosts (`exeArgs=service`,
|
||||
argv+CWD detection, `Initialize`+`PrepareToHostSingle`+
|
||||
`StartServiceCtrlDispatcher`); hidden imports added to the build
|
||||
script. Needs ONE careful elevated live pass (install → start →
|
||||
kill-server → stop → reboot) against the built exe — terminal here
|
||||
is not elevated; the in-process debug-host run is verified.
|
||||
|
||||
## Phase 4 — Integration & chaos testing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user