diff --git a/Cargo.toml b/Cargo.toml index 02b2033..5533da5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "systemctl" -version = "0.3.0" +version = "0.3.1" license = "MIT OR Apache-2.0" authors = ["Guillaume W. Bres "] description = "Small crate to interact with systemd units" diff --git a/src/lib.rs b/src/lib.rs index 853c286..c86688c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,6 +89,16 @@ pub fn stop(unit: &str) -> std::io::Result { systemctl(vec!["stop", unit]) } +/// Triggers reload for given `unit` +pub fn reload(unit: &str) -> std::io::Result { + systemctl(vec!["reload", unit]) +} + +/// Triggers reload or restarts given `unit` +pub fn reload_or_restart(unit: &str) -> std::io::Result { + systemctl(vec!["reload-or-restart", unit]) +} + /// Enable given `unit` to start at boot pub fn enable(unit: &str) -> std::io::Result { systemctl(vec!["enable", unit]) @@ -578,6 +588,16 @@ impl Unit { stop(&self.name) } + /// Reloads Self by invoking systemctl + pub fn reload(&self) -> std::io::Result { + reload(&self.name) + } + + /// Reloads or restarts Self by invoking systemctl + pub fn reload_or_restart(&self) -> std::io::Result { + reload_or_restart(&self.name) + } + /// Enable Self to start at boot pub fn enable(&self) -> std::io::Result { enable(&self.name)