Update
This commit is contained in:
parent
2c7b5bd865
commit
8e848fc104
9 changed files with 133 additions and 12 deletions
|
|
@ -1,2 +1,3 @@
|
|||
pub mod user_session;
|
||||
pub mod node_js_user_service;
|
||||
pub mod reload;
|
||||
pub mod user_session;
|
||||
|
|
|
|||
36
src/symbols/systemd/reload.rs
Normal file
36
src/symbols/systemd/reload.rs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
use std::error::Error;
|
||||
use std::fmt;
|
||||
|
||||
use command_runner::CommandRunner;
|
||||
use symbols::Symbol;
|
||||
|
||||
pub struct ReloadService<'a> {
|
||||
service: &'a str,
|
||||
command_runner: &'a CommandRunner
|
||||
}
|
||||
|
||||
impl<'a> ReloadService<'a> {
|
||||
pub fn new(service: &'a str, command_runner: &'a CommandRunner) -> Self {
|
||||
ReloadService {
|
||||
service: service,
|
||||
command_runner: command_runner
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Symbol for ReloadService<'a> {
|
||||
fn target_reached(&self) -> Result<bool, Box<Error>> {
|
||||
Ok(true)
|
||||
}
|
||||
|
||||
fn execute(&self) -> Result<(), Box<Error>> {
|
||||
try!(self.command_runner.run_with_args("systemctl", &["reload-or-restart", self.service]));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for ReloadService<'a> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> Result<(),fmt::Error>{
|
||||
write!(f, "Reload service {}", self.service)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue