pkg-cache selfcheck: re-check nginx started by something else while stopped; fix test fake is-active

The marker branch left a manually/otherwise restarted nginx running unchecked
while the disks were still bad. Now a running nginx with our marker present is
judged like normal operation (stopped again if unhealthy). The test systemctl
fake always returned 0 for is-active, hiding the admin-stopped branch; fixed,
and the tests now pin PKGCACHE_SERVICES and cover the empty-list case.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-11-29 07:30:52 -08:00
1 parent 8107b29e14
commit bd685f72fb
2 files changed
+18 -1

No files matched your search

+7
View File
@@ -93,6 +93,13 @@ stop_services() {
}
# ---- main ---------------------------------------------------------------------
# Something else (an admin, a package script) started nginx while our stop marker exists:
# do not "recover" on our own schedule or leave it running unchecked. Drop the marker and
# judge it like normal operation below, which stops it again if the cache is unhealthy.
if [ -e "$MARKER" ] && $SYSTEMCTL is-active --quiet nginx; then
log warning "nginx was started by something else while stopped by this script; re-checking it now"
rm -f "$MARKER" "$OKFILE"
fi
if [ -e "$MARKER" ]; then
# we stopped the services earlier: look for recovery
if why=$(check_disks); then