12 releases (7 breaking)

0.7.0 Nov 8, 2023
0.6.0 Dec 20, 2022
0.5.0 Jan 11, 2022
0.4.1 Nov 17, 2021
0.0.2 Sep 17, 2017

#69 in Unix APIs

Download history 3130/week @ 2023-12-13 4403/week @ 2023-12-20 2823/week @ 2023-12-27 3617/week @ 2024-01-03 3723/week @ 2024-01-10 4315/week @ 2024-01-17 5874/week @ 2024-01-24 7288/week @ 2024-01-31 5431/week @ 2024-02-07 6058/week @ 2024-02-14 5787/week @ 2024-02-21 5681/week @ 2024-02-28 5931/week @ 2024-03-06 4751/week @ 2024-03-13 5723/week @ 2024-03-20 3988/week @ 2024-03-27

21,819 downloads per month
Used in 19 crates (13 directly)

MIT/Apache

95KB
2K SLoC

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.

Dependencies

~4.5MB
~93K SLoC