[#1318] Wait for Unix startup and shutdown in the shell (#1319)
Fixes #1318
## Changes
- Share a shell wait loop between Unix detached `start-ds` and local
`stop-ds`. The wait ends when the corresponding startup marker or PID
file disappears.
- Preserve startup log forwarding, quiet mode, the validated startup
timeout, and the final startability check. If the server child exits
before readiness, report its exit status, including when setup passes
`--timeout 0`. Waiting still works when `server.out` cannot be opened
for reading.
- Keep the Java stoppability preflight, `SIGTERM`, the 200-second local
shutdown timeout, quiet restart, and LDAP fallback. Forward new
`logs/errors` data from the open descriptor, including the final lines
when the log rotates during shutdown.
- Use `stat` on the open shutdown log descriptor and a one-byte `dd`
read at the end before sending `SIGTERM`. The same descriptor forwards
new bytes during log rotation. If log positioning fails, continue the
shutdown without forwarding the log.
## Validation
- Ran the Unix launcher self-test with `dash`, `ksh`, macOS `sh`, and
BusyBox `sh` on Alpine. It covers successful startup, early child exit,
timeout, quiet mode, the final probe, and unreadable startup logs. The
fixture checks that the Java startup preflight receives `-t1` as a
distinct argument.
- Added shutdown cases for new log output, rotation before PID file
removal, an unreadable log, quiet restart, and timeout followed by LDAP
fallback. The 64 GiB sparse-log case rejects an unbounded read, and the
failed-`stat` case verifies that shutdown still completes.
- Verified local shutdown on a packaged server with JDK 21. `stop-ds`
returned `0` after an LDAP readiness check, `server.pid` disappeared,
and the Java trace showed only `--checkStoppability`.
- Earlier JDK 21 validation of the detached startup change covered a
live child timing out through the real Java preflight and a successful
startup with `server.out` mode `0200`. All 20 tests in the three
targeted Maven integration classes passed.
- Ran the updated launcher self-test under `dash` on Ubuntu 26.04 with
`uutils coreutils` 0.10.0, under `dash` and `ksh` on macOS, and under
BusyBox `sh` on Alpine. The checks cover stale log output, rotation, and
the 64 GiB sparse log.
- `git diff --check` and launcher syntax checks passed.