systemd: add reload_unit

via try-reload-or-restart

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-04-22 16:01:47 +02:00 committed by Dietmar Maurer
parent c0147e49c4
commit b1c793cfa5
1 changed files with 11 additions and 0 deletions

View 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> {