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.
This commit is contained in:
parent
9716019cfb
commit
f00b7d0133
1 changed files with 3 additions and 0 deletions
|
@ -6,6 +6,7 @@ use std::thread;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
use sd_notify::NotifyState;
|
||||||
use serde_json::{Map, Value};
|
use serde_json::{Map, Value};
|
||||||
use url_escape;
|
use url_escape;
|
||||||
|
|
||||||
|
@ -98,6 +99,8 @@ fn main() -> Result<()> {
|
||||||
fs::write(&output_path, output)
|
fs::write(&output_path, output)
|
||||||
.expect(format!("To be able to write to '{}'", output_path.to_string_lossy()).as_str());
|
.expect(format!("To be able to write to '{}'", output_path.to_string_lossy()).as_str());
|
||||||
|
|
||||||
|
sd_notify::notify(true, &[NotifyState::Ready])?;
|
||||||
|
|
||||||
if idle {
|
if idle {
|
||||||
loop {
|
loop {
|
||||||
thread::park();
|
thread::park();
|
||||||
|
|
Loading…
Reference in a new issue