Private
Public Access
1
0

fix: use resolved service name for socket activation detection

This commit is contained in:
2026-05-07 01:42:20 +00:00
parent 18bf40e78b
commit 432e6785b2
3 changed files with 11 additions and 2 deletions

View File

@ -571,7 +571,9 @@ fn get_systemd_service_status(name: &str) -> Result<Option<ServiceStatus>> {
// Check for socket activation: if service is inactive but enabled,
// check if the corresponding .socket unit is active (listening)
let healthy = if !healthy && active_state == "inactive" && unit_file_state == "enabled" {
let socket_name = format!("{}.socket", name.trim_end_matches(".service"));
// Use the resolved service name (id) instead of input name,
// so "sshd" resolves to "ssh.service" → "ssh.socket" correctly
let socket_name = format!("{}.socket", id.trim_end_matches(".service"));
if let Ok(socket_output) = Command::new("systemctl")
.args(["show", &socket_name, "--property=ActiveState", "--no-pager"])
.output()