Expand description
Systemd notification support
Provides a wrapper for communicating with systemd:
- Ready notification (
READY=1) - Stopping notification (
STOPPING=1) - Status updates (shown in
systemctl status) - Watchdog pings (
WATCHDOG=1)
§Usage
ⓘ
use hyprstream_core::systemd::SystemdNotifier;
// Signal service is ready
SystemdNotifier::ready();
// Update status (shown in systemctl status)
SystemdNotifier::status("Processing 42 requests");
// Signal stopping
SystemdNotifier::stopping();§Watchdog Integration
For services with WatchdogSec= configured:
ⓘ
// Check if watchdog is enabled and get ping interval
if let Some(interval) = SystemdNotifier::watchdog_interval() {
// Ping watchdog at the recommended interval (half of WatchdogSec)
loop {
tokio::time::sleep(interval).await;
if is_healthy().await {
SystemdNotifier::watchdog();
}
// If unhealthy, don't ping - systemd will restart us
}
}Structs§
- Systemd
Notifier - Systemd notification wrapper