1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
# Run first on a fresh dev boot, before tests replace the original worker.
# Uses a graceful signal, never changes the shared VM/host clock.
set -eu
B=http://127.0.0.1:8080
for pass in 1 2 3; do
WEB=$(pgrep -f '^lighttpd -D -f /src/test/lighttpd-dev.conf$')
WORKER=$(pgrep -f '^/usr/local/sbin/signetd$')
[ -n "$WEB" ] && [ -n "$WORKER" ]
kill -USR1 "$WEB"
sleep 1
OK=no
for i in $(seq 1 10); do
if curl -fsS --max-time 1 "$B/" >/dev/null 2>&1; then OK=yes; break; fi
sleep .1
done
[ "$OK" = yes ] || { echo 'FAIL - preview stops responding after graceful restart while worker stays alive'; exit 1; }
kill -0 "$WORKER"
[ "$(awk '/^PPid:/ {print $2}' "/proc/$WORKER/status")" != "$WEB" ] || {
echo 'FAIL - web server owns the long-lived signing worker'; exit 1;
}
curl -fsS --max-time 2 -H 'Remote-User: manager' -H 'Remote-Groups: management' "$B/api/me" | jq -e '.user=="manager"' >/dev/null
sleep .2
done
echo 'dev graceful restart: HTTP/API responsive and signing worker preserved across three restarts'