libsystemd

Crates.iolibsystemd
lib.rslibsystemd
version0.7.0
sourcesrc
created_at2017-09-03 20:26:37.997503
updated_at2023-11-08 14:04:16.350679
descriptionA pure-Rust client library to interact with systemd
homepage
repositoryhttps://github.com/lucab/libsystemd-rs
max_upload_size
id30420
size137,478
Sebastian Wiesner (swsnr)

documentation

https://docs.rs/libsystemd

README

libsystemd

crates.io LoC Documentation

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 the libsystemd C library.

NB: this crate is not yet features-complete. If you don't care about C dependency, check rust-systemd instead.

Example

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

fn main() {
    if !daemon::booted() {
        panic!("Not running systemd, early exit.");
    };

    let sent = daemon::notify(true, &[NotifyState::Ready]).expect("notify failed");
    if !sent {
        panic!("Notification not sent, early exit.");
    };
    std::thread::park();
}

Some more examples are available under examples.

License

Licensed under either of

at your option.

Commit count: 275

cargo fmt