From e1d9c956beb6921b0d549248bea3a6853fde5f46 Mon Sep 17 00:00:00 2001 From: Toby Vincent Date: Sat, 28 Sep 2024 01:08:16 -0500 Subject: fix: clean up unused code and fix TCP client --- src/service/systemd.rs | 27 +-------------------------- 1 file changed, 1 insertion(+), 26 deletions(-) (limited to 'src/service/systemd.rs') diff --git a/src/service/systemd.rs b/src/service/systemd.rs index e3b4d1b..90213a0 100644 --- a/src/service/systemd.rs +++ b/src/service/systemd.rs @@ -1,4 +1,4 @@ -use std::{fmt::Display, process::Command, time::Duration}; +use std::{process::Command, time::Duration}; use serde::Deserialize; use tokio::sync::watch::Sender; @@ -12,12 +12,6 @@ pub struct Systemd { pub service: String, } -impl Display for Systemd { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}.service", self.service.trim_end_matches(".service")) - } -} - impl ServiceSpawner for Systemd { async fn spawn(self, tx: Sender) -> Result<(), Error> { let mut command = Command::new("systemctl"); @@ -43,22 +37,3 @@ impl ServiceSpawner for Systemd { } } } - -impl Systemd { - pub async fn check(&self) -> Result { - let output = Command::new("systemctl") - .arg("is-active") - .arg(&self.service) - .output()?; - - let status = match output.status.success() { - true => Status::Pass, - false => { - let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string(); - Status::Fail(Some(format!("Service state: {}", stdout))) - } - }; - - Ok(status) - } -} -- cgit v1.2.3-70-g09d2