summaryrefslogtreecommitdiffstats
path: root/src/service/systemd.rs
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-09-28 01:08:16 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-09-28 01:08:16 -0500
commite1d9c956beb6921b0d549248bea3a6853fde5f46 (patch)
treec01098af5a024b00db50b0326dc67f79d7825ef9 /src/service/systemd.rs
parentcd774827dd14f68d8405c45d2d9da30b3fab050e (diff)
fix: clean up unused code and fix TCP client
Diffstat (limited to 'src/service/systemd.rs')
-rw-r--r--src/service/systemd.rs27
1 files changed, 1 insertions, 26 deletions
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<Status>) -> Result<(), Error> {
let mut command = Command::new("systemctl");
@@ -43,22 +37,3 @@ impl ServiceSpawner for Systemd {
}
}
}
-
-impl Systemd {
- pub async fn check(&self) -> Result<Status, Error> {
- 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)
- }
-}