use std::error::Error; use std::fmt; use std::io; use std::ops::Deref; use command_runner::CommandRunner; use symbols::Symbol; use symbols::file::File as FileSymbol; use resources::Resource; pub struct NginxReload<'a> { command_runner: &'a CommandRunner, } use std::borrow::Cow; impl<'a> NginxReload<'a> { pub fn new(command_runner: &'a CommandRunner) -> Self { NginxReload { command_runner: command_runner } } } impl<'a> Symbol for NginxReload<'a> { fn target_reached(&self) -> Result> { Ok(true) } fn execute(&self) -> Result<(), Box> { try!(self.command_runner.run_with_args("systemctl", &["reload-or-restart", "nginx"])); Ok(()) } } impl<'a> fmt::Display for NginxReload<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> Result<(),fmt::Error>{ write!(f, "Reload nginx server") } }