Crate remora_systemd
Expand description
D-Bus client for the systemd service manager.
The crate has async proxies for three interfaces of the
org.freedesktop.systemd1 service, which is systemd running as PID 1 or as
a user manager.
ManagerProxyis the entry point at/org/freedesktop/systemd1.UnitProxycovers one unit object.JobProxycovers one job object.
The crate does not cover the unit type interfaces yet. These are the
interfaces that each unit object has besides the unit interface,
such as Service, Socket, Mount, Swap, Slice, Scope and Timer.
use remora_systemd::{JobMode, ManagerProxy};
let connection = zbus::Connection::system().await?;
let manager = ManagerProxy::new(&connection).await?;
manager.subscribe().await?;
let job = manager
.restart_unit("example.service", &JobMode::Replace)
.await?;
println!("queued {job}");§Versions
The crate covers systemd 262. Members without a version note exist in systemd 249 and later. Other members say in which release they appeared. Calls to a member that the running service lacks fail with a D-Bus error.
The crate does not cover members that upstream hides or removed.
Upstream documentation: https://www.freedesktop.org/software/systemd/man/latest/org.freedesktop.systemd1.html.
Re-exports§
pub use zbus;
Modules§
Structs§
- Dynamic
User - A user that the manager allocated for a unit with
DynamicUser=. - Enqueue
Unit JobReply - The result of
EnqueueUnitJob. - Enqueued
Job - A job that a transaction queued.
- File
Descriptor Store Entry - An entry of the file descriptor store of a unit.
- Install
Changes - The result of the unit file operations that report install information.
- JobNew
- A
JobNewsignal. - JobNew
Args JobNewsignal arguments.- JobNew
Stream - A
Streamimplementation that yieldsJobNewsignals. - JobProxy
- Client for the
org.freedesktop.systemd1.Jobinterface of systemd. - JobRemoved
- A
JobRemovedsignal. - JobRemoved
Args JobRemovedsignal arguments.- JobRemoved
Stream - A
Streamimplementation that yieldsJobRemovedsignals. - JobStatus
- A queued job in the result of
ListJobs,GetJobAfterandGetJobBefore. - JobUnit
Ref - The unit of a job, the
(so)value of theUnitproperty of a job. - Load
Error - The reason why a unit failed to load.
- Manager
Proxy - Client for the
org.freedesktop.systemd1.Managerinterface of systemd. - Reloading
- A
Reloadingsignal. - Reloading
Args Reloadingsignal arguments.- Reloading
Stream - A
Streamimplementation that yieldsReloadingsignals. - Startup
Finished - A
StartupFinishedsignal. - Startup
Finished Args StartupFinishedsignal arguments.- Startup
Finished Stream - A
Streamimplementation that yieldsStartupFinishedsignals. - Unit
ByPid Fd - The result of
GetUnitByPIDFD. - Unit
Condition - A condition or an assertion of a unit.
- Unit
File Change - A change that a unit file operation made on disk.
- Unit
File Flags - Options of the unit file operations that take flags.
- Unit
File Info - A unit file in the result of the
ListUnitFilesfamily of methods. - Unit
Files Changed - A
UnitFilesChangedsignal. - Unit
Files Changed Stream - A
Streamimplementation that yieldsUnitFilesChangedsignals. - Unit
JobRef - The job of a unit, the
(uo)value of theJobproperty of a unit. - UnitNew
- A
UnitNewsignal. - Unit
NewArgs UnitNewsignal arguments.- Unit
NewStream - A
Streamimplementation that yieldsUnitNewsignals. - Unit
Process - A process of a unit, as
GetUnitProcessesreturns it. - Unit
Proxy - Client for the
org.freedesktop.systemd1.Unitinterface of systemd. - Unit
Removed - A
UnitRemovedsignal. - Unit
Removed Args UnitRemovedsignal arguments.- Unit
Removed Stream - A
Streamimplementation that yieldsUnitRemovedsignals. - Unit
Status - A loaded unit in the result of the
ListUnitsfamily of methods.
Enums§
- Active
State - The high-level state of a unit.
- Clean
Resource - A kind of data that
CleanUnitcan delete. - Collect
Mode - When the manager may unload an unreferenced unit.
- Dependency
Type - A kind of dependency that
AddDependencyUnitFilescan add. - Emergency
Action - An action that the manager takes on the system or on itself.
- Freezer
State - The freezer state of a unit.
- JobMode
- How a job request treats queued jobs and dependencies.
- JobResult
- The result of a finished job.
- JobState
- The state of a job.
- JobType
- The type of a job.
- Kill
Whom - The processes of a unit that a kill request targets.
- Load
State - Whether the configuration of a unit is loaded.
- OomPolicy
- What the manager does with a service when the kernel kills one of its processes for lack of memory.
- Preset
Mode - What a preset operation may change.
- Pressure
Watch - Whether the manager watches the pressure stall information of a unit.
- System
State - The state of the service manager.
- Unit
File Change Type - The kind of a change that a unit file operation made.
- Unit
File Preset - The preset state of a unit file.
- Unit
File State - The install state of a unit file.
- Unit
Marker - A marker that records a pending action on a unit.