Crate libsystemd

Source
Expand description

A pure-Rust client library to work with systemd.

It provides support to interact with systemd components available on modern Linux systems. This crate is entirely implemented in Rust, and does not require an external libsystemd dynamic library.

use libsystemd::daemon::{self, NotifyState};

fn notify_ready() -> bool {
    if !daemon::booted() {
        println!("Not running systemd, early exit.");
        return false;
    };

    let sent = daemon::notify(true, &[NotifyState::Ready]).expect("notify failed");
    if !sent {
        println!("Notification not sent!");
    };
    sent
}

Modulesยง

activation
Interfaces for socket-activated services.
credentials
Helpers for securely passing potentially sensitive data to services.
daemon
Interfaces for systemd-aware daemons.
errors
Error handling.
id128
APIs for processing 128-bits IDs.
logging
Helpers for logging to systemd-journald.
sysusers
Helpers for working with sysusers.d configuration files.
unit
Helpers for working with systemd units.