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

#80 in Unix APIs

Download history 6522/week @ 2024-07-22 8411/week @ 2024-07-29 7106/week @ 2024-08-05 5693/week @ 2024-08-12 4430/week @ 2024-08-19 5388/week @ 2024-08-26 4906/week @ 2024-09-02 5261/week @ 2024-09-09 4051/week @ 2024-09-16 4698/week @ 2024-09-23 3965/week @ 2024-09-30 4442/week @ 2024-10-07 4787/week @ 2024-10-14 4893/week @ 2024-10-21 8292/week @ 2024-10-28 5442/week @ 2024-11-04

23,574 downloads per month
Used in 22 crates (15 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