sdnotify 0.2.0

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

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};

# fn notify() -> Result<(), Error> {
    let notifier = SdNotify::from_env()?;
    notifier.notify_ready()?;
#   Ok(())
# }

Async API

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

# fn notify() -> Result<(), Error> {
    let notifier = SdNotify::from_env()?;
    let mut rt = Runtime::new().unwrap();
    rt.block_on(notifier.send(Message::ready())).unwrap();
#   Ok(())
# }