requires: couples a dependent to its dependency's failure. A manual
gopherd restart db is not a failure, so by default the requirers keep running
against a briefly absent db. restart-with-dependents: true on db makes
the control-socket restart bounce them too, in order:
- running services that transitively
requires: [db]stop, last-started first dbstops and starts again through its readiness gates (ready-check,sd-notify)- the stopped requirers start again in start order, through their own gates
Requirers that were already stopped are left alone. Automatic restarts
(on-failure: restart, on-check-failure) keep plain requires semantics
and do not cascade. A step that fails to start aborts the rest and, like a
failed automatic restart, shuts gopherd down with exit code 1.
Combine with --wait to block until the whole sequence is done:
gopherd restart db --wait --timeout 30s
# db: restarted (pid 123); dependents restarted: webWithout --wait the sequence runs in the background and the reply names what
will be bounced: db: restart scheduled (with dependents: web).
processes:
- name: db
command: /usr/local/bin/db
args: ["300"]
restart-with-dependents: true
on-failure: ignore
- name: web
command: /usr/local/bin/web
args: ["300"]
requires: [db]
on-failure: ignorerestart db --waitreturns after bothdbandwebrun with new pids.webexited beforedbwas restarted and came back after it.restart web(no flag onweb) restarts onlyweb.
Run level. The test substitutes sleep for both commands, records the pids,
runs restart db --wait, and asserts the reply names web and both pids
changed. It then runs restart web --wait and asserts db kept its pid.
SIGTERM yields a clean exit 0.
The harness substitutes the {{SOCKET}} token in control.socket with a
temporary socket path.
go test ./documentation/restart-with-dependents/ -v