Expand description
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();