Skip to main content

Crate remora_systemd

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.

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§

job 🔒
manager 🔒
unit 🔒

Structs§

DynamicUser
A user that the manager allocated for a unit with DynamicUser=.
EnqueueUnitJobReply
The result of EnqueueUnitJob.
EnqueuedJob
A job that a transaction queued.
FileDescriptorStoreEntry
An entry of the file descriptor store of a unit.
InstallChanges
The result of the unit file operations that report install information.
JobNew
A JobNew signal.
JobNewArgs
JobNew signal arguments.
JobNewStream
A Stream implementation that yields JobNew signals.
JobProxy
Client for the org.freedesktop.systemd1.Job interface of systemd.
JobRemoved
A JobRemoved signal.
JobRemovedArgs
JobRemoved signal arguments.
JobRemovedStream
A Stream implementation that yields JobRemoved signals.
JobStatus
A queued job in the result of ListJobs, GetJobAfter and GetJobBefore.
JobUnitRef
The unit of a job, the (so) value of the Unit property of a job.
LoadError
The reason why a unit failed to load.
ManagerProxy
Client for the org.freedesktop.systemd1.Manager interface of systemd.
Reloading
A Reloading signal.
ReloadingArgs
Reloading signal arguments.
ReloadingStream
A Stream implementation that yields Reloading signals.
StartupFinished
A StartupFinished signal.
StartupFinishedArgs
StartupFinished signal arguments.
StartupFinishedStream
A Stream implementation that yields StartupFinished signals.
UnitByPidFd
The result of GetUnitByPIDFD.
UnitCondition
A condition or an assertion of a unit.
UnitFileChange
A change that a unit file operation made on disk.
UnitFileFlags
Options of the unit file operations that take flags.
UnitFileInfo
A unit file in the result of the ListUnitFiles family of methods.
UnitFilesChanged
A UnitFilesChanged signal.
UnitFilesChangedStream
A Stream implementation that yields UnitFilesChanged signals.
UnitJobRef
The job of a unit, the (uo) value of the Job property of a unit.
UnitNew
A UnitNew signal.
UnitNewArgs
UnitNew signal arguments.
UnitNewStream
A Stream implementation that yields UnitNew signals.
UnitProcess
A process of a unit, as GetUnitProcesses returns it.
UnitProxy
Client for the org.freedesktop.systemd1.Unit interface of systemd.
UnitRemoved
A UnitRemoved signal.
UnitRemovedArgs
UnitRemoved signal arguments.
UnitRemovedStream
A Stream implementation that yields UnitRemoved signals.
UnitStatus
A loaded unit in the result of the ListUnits family of methods.

Enums§

ActiveState
The high-level state of a unit.
CleanResource
A kind of data that CleanUnit can delete.
CollectMode
When the manager may unload an unreferenced unit.
DependencyType
A kind of dependency that AddDependencyUnitFiles can add.
EmergencyAction
An action that the manager takes on the system or on itself.
FreezerState
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.
KillWhom
The processes of a unit that a kill request targets.
LoadState
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.
PresetMode
What a preset operation may change.
PressureWatch
Whether the manager watches the pressure stall information of a unit.
SystemState
The state of the service manager.
UnitFileChangeType
The kind of a change that a unit file operation made.
UnitFilePreset
The preset state of a unit file.
UnitFileState
The install state of a unit file.
UnitMarker
A marker that records a pending action on a unit.