Update the status string shown by `systemctl status`. Corresponds to systemd's `STATUS= `. Safe to call from any phase — passing a short human-readable string such as `"bootstrapping cluster"`, `"joining via 10.0.0.1:9400"`, or `"ready (3 nodes)"` makes cluster startup visibly progress even while `READY=1` has not yet been sent.
(msg: &str)
| 43 | /// `"ready (3 nodes)"` makes cluster startup visibly progress even |
| 44 | /// while `READY=1` has not yet been sent. |
| 45 | pub fn notify_status(msg: &str) { |
| 46 | #[cfg(target_os = "linux")] |
| 47 | { |
| 48 | match sd_notify::notify(false, &[sd_notify::NotifyState::Status(msg)]) { |
| 49 | Ok(()) => debug!(status = msg, "sd_notify STATUS sent"), |
| 50 | Err(e) => warn!(error = %e, status = msg, "sd_notify STATUS failed"), |
| 51 | } |
| 52 | } |
| 53 | #[cfg(not(target_os = "linux"))] |
| 54 | { |
| 55 | let _ = msg; |
| 56 | debug!("sd_notify not supported on this platform; notify_status is a no-op"); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /// Signal that the server is shutting down. |
| 61 | /// |