Print message when stopping the daemon (SIGTERM)
systemd sends SIGTERM when stopping a service. When running in a tty, CTRL + C (SIGINT) currently won't print a shutdown message.
This commit is contained in:
parent
bb51ff77b1
commit
e6ffb3f3e1
@ -55,6 +55,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
|
|
||||||
// Will (afaik) be stabilized in Rust 1.48
|
// Will (afaik) be stabilized in Rust 1.48
|
||||||
// core::future::pending::<()>().await;
|
// core::future::pending::<()>().await;
|
||||||
loop {};
|
tokio::signal::unix::signal(tokio::signal::unix::SignalKind::terminate())?.recv().await;
|
||||||
unreachable!();
|
info!("Got SIGTERM, shutting down");
|
||||||
|
Ok(())
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user