MCPcopy Create free account
hub / github.com/ermak-dev/cloudpub / status

Method status

client/src/service/linux.rs:101–120  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

99 }
100
101 fn status(&self) -> Result<ServiceStatus> {
102 let service_path = self.service_file_path();
103 let service_file = Path::new(&service_path);
104 if !service_file.exists() {
105 return Ok(ServiceStatus::NotInstalled);
106 }
107
108 let output = Command::new("systemctl")
109 .args(["is-active", &self.config.name])
110 .output()
111 .context("Failed to check service status")?;
112
113 let status_str = String::from_utf8_lossy(&output.stdout).trim().to_string();
114
115 match status_str.as_str() {
116 "active" => Ok(ServiceStatus::Running),
117 "inactive" => Ok(ServiceStatus::Stopped),
118 _ => Ok(ServiceStatus::Unknown),
119 }
120 }
121}

Callers 6

downloadFunction · 0.45
handle_service_commandFunction · 0.45
installMethod · 0.45
uninstallMethod · 0.45
startMethod · 0.45
stopMethod · 0.45

Calls 1

service_file_pathMethod · 0.80

Tested by

no test coverage detected