#systemd #daemon #notify #service #status #manager #completion

sdnotify

Notify service manager about start-up completion and other daemon status changes

5 releases

0.2.0 Jun 23, 2021
0.1.3 Apr 14, 2020
0.1.2 Sep 19, 2019
0.1.1 Sep 19, 2019
0.1.0 Sep 17, 2019

#977 in Unix APIs

Download history 10/week @ 2024-09-01 3/week @ 2024-09-15 5/week @ 2024-09-22 51/week @ 2024-09-29 3/week @ 2024-10-06 2/week @ 2024-10-13 2/week @ 2024-11-03 2/week @ 2024-11-10 3/week @ 2024-11-24 11/week @ 2024-12-01 38/week @ 2024-12-08 87/week @ 2024-12-15

139 downloads per month

MIT license

12KB
216 lines

Notify service manager about start-up completion and other daemon status changes.

Prerequisites

A unit file with service type Notify is required.

Example:

[Unit]
Description=Frobulator
[Service]
Type=notify
ExecStart=/usr/sbin/frobulator
[Install]
WantedBy=multi-user.target

Sync API

    use sdnotify::{SdNotify, Message, Error};

    let notifier = SdNotify::from_env()?;
    notifier.notify_ready()?;

Async API

    use sdnotify::{Message, Error, async_io::SdNotify};
    use tokio::prelude::*;
    use tokio::runtime::current_thread::Runtime;

    let notifier = SdNotify::from_env()?;
    let mut rt = Runtime::new().unwrap();
    rt.block_on(notifier.send(Message::ready())).unwrap();

Dependencies

~0–8.5MB
~68K SLoC