]> git.proxmox.com Git - proxmox-backup.git/commitdiff
systemd: add reload_unit
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 22 Apr 2021 14:01:47 +0000 (16:01 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 28 Apr 2021 10:15:26 +0000 (12:15 +0200)
via try-reload-or-restart

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/tools/systemd.rs

index f8ae789cf45b0b36966086a3ea6a106d711fa7f1..c17607819a66cd33bf96906429c3c9900af43661 100644 (file)
@@ -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> {