Expand description
Service installation (spec 3.2 §7.12, §10 W3): adk-rust up kept running by the
platform’s service manager, as the user, logging to the kernel home and restarting on
failure.
| Platform | Form | Definition | Starts |
|---|---|---|---|
| macOS | launchd agent | ~/Library/LaunchAgents/<name>.plist | At login, in the user’s session |
| Linux | systemd user unit | <config dir>/systemd/user/<name>.service | With the user’s service manager: at login, or at boot with lingering on |
| Windows | Windows service under the user’s account | The service control manager | At boot (delayed automatic start) |
Each form runs as the user, so a store key held in the OS keychain stays reachable: an
agent rather than a daemon, a user unit, a service under the user’s account — which the
service control manager needs that account’s password to start. Each writes the
kernel’s output to <home>/kernel.log, created owner-only, and restarts the kernel when
it exits with an error or dies: launchd’s KeepAlive on an unsuccessful exit, systemd’s
Restart=on-failure, and the service’s failure actions (a restart after 5, 10 and 30
seconds; an exit with an error counts as a failure). Stopping the service drains the
kernel as SIGTERM does.
ServiceDefinition::render shows what install registers, for any platform,
without installing anything; adk-rust up --install --print prints it.
§Example
use adk_kernel::service::{ServiceDefinition, ServicePlatform};
let definition = ServiceDefinition::new("/usr/local/bin/adk-rust", "/home/ana/.config/adk-rust")
.with_working_directory("/home/ana/project");
let unit = definition.render(ServicePlatform::Systemd);
assert!(unit.contains("ExecStart=/usr/local/bin/adk-rust up --home /home/ana/.config/adk-rust\n"));
assert!(unit.contains("Restart=on-failure\n"));
assert!(unit.contains("StandardOutput=append:/home/ana/.config/adk-rust/kernel.log\n"));Structs§
- Installed
- What
installdid. - Service
Definition - What the service manager runs:
adk-rust upwith a kernel home (spec 3.2 §7.12). - Uninstalled
- What
uninstalldid.
Enums§
- Service
Platform - A service manager the kernel installs into (spec 3.2 §7.12).
Constants§
- LOG_
FILE - The file under the kernel home the service writes the kernel’s output to.
Functions§
- install
- Installs
definitioninto this platform’s service manager and starts it (spec 3.2 §7.12), replacing an installed service of the same name. - stop_
requested - Resolves when the Windows service control manager asks this process, running as the
kernel’s service, to stop or the system is shutting down (spec 3.2 §10 W3); never
otherwise, and never on other platforms, whose service managers send
SIGTERM.Kernel::shutdown_on_signalwaits for it. - uninstall
- Stops and removes the service
name(spec 3.2 §7.12): the reverse ofinstall. The kernel home, its stores and its log stay.