From f00b7d01336f0d032f56467c9d9d37a0128eda34 Mon Sep 17 00:00:00 2001 From: networkException Date: Thu, 12 Sep 2024 03:30:14 +0200 Subject: [PATCH] Main: Notify systemd about being ready after writing to the output path via sd_notify When running in a systemd service with the --idle flag we want to have systemd's service dependency chain depend on the templated secret file being written to the output path. --- src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main.rs b/src/main.rs index b174345..dd50f33 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ use std::thread; use anyhow::Result; use clap::Parser; +use sd_notify::NotifyState; use serde_json::{Map, Value}; use url_escape; @@ -98,6 +99,8 @@ fn main() -> Result<()> { fs::write(&output_path, output) .expect(format!("To be able to write to '{}'", output_path.to_string_lossy()).as_str()); + sd_notify::notify(true, &[NotifyState::Ready])?; + if idle { loop { thread::park();