[pbs-devel] [PATCH v2 backup 01/27] systemd: add reload_unit
Wolfgang Bumiller
w.bumiller at proxmox.com
Thu Apr 22 16:01:47 CEST 2021
via try-reload-or-restart
Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
---
src/tools/systemd.rs | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/tools/systemd.rs b/src/tools/systemd.rs
index f8ae789c..c1760781 100644
--- a/src/tools/systemd.rs
+++ b/src/tools/systemd.rs
@@ -131,6 +131,17 @@ pub fn stop_unit(unit: &str) -> Result<(), Error> {
Ok(())
}
+pub fn reload_unit(unit: &str) -> Result<(), Error> {
+
+ let mut command = std::process::Command::new("systemctl");
+ command.arg("try-reload-or-restart");
+ command.arg(unit);
+
+ crate::tools::run_command(command, None)?;
+
+ Ok(())
+}
+
#[test]
fn test_escape_unit() -> Result<(), Error> {
--
2.20.1
More information about the pbs-devel
mailing list