ref:main

feat(runner): add svc-restart subcommand #15

open colechristensen cole.christensen@gmail.com wants to merge fix/install-restart-on-upgrade into main
No CI Mergeable

Summary

Adds `anvil runner service svc-restart` to mirror the existing `svc-start` and `svc-stop` subcommands. Needed by the parallel install.sh fix in the anvil server repo (issue #2 — "install.sh skips service restart when no legacy migration is needed"): after the installer swaps the binary on disk, it needs a way to ask the running service to re-exec.

Implementation

  • systemd: `systemctl restart anvil-runner` — native verb.
  • launchd: no `restart` verb, so emulate `unload` + `load`. The unload step is treated as non-fatal because the service may already be stopped; only `load` failures surface as errors.

Test plan

  • `cargo test` — 32/32 pass (4 new clap-parsing tests for `svc-start` / `svc-stop` / `svc-restart` / `svc-status`)
  • `cargo clippy –all-targets – -D warnings` clean
  • `cargo fmt` clean
  • `anvil runner service –help` lists `svc-restart` alongside the existing verbs

What’s next

The user-facing fix for issue #2 (the actual install.sh restart-on-upgrade behavior) lives in the anvil server repo at `lib/anvil_web/controllers/runner_download_controller.ex`. That PR depends on this subcommand existing and will be filed separately.

Refs #2

Created May 08, 2026 at 18:04 UTC