Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ea0194c6c | |||
| fb3ba3f2c1 | |||
| 4b32db0d26 |
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "linux-patch-api"
|
name = "linux-patch-api"
|
||||||
version = "0.3.8"
|
version = "0.3.10"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Echo <echo@moon-dragon.us>"]
|
authors = ["Echo <echo@moon-dragon.us>"]
|
||||||
description = "Secure remote package management API for Linux systems"
|
description = "Secure remote package management API for Linux systems"
|
||||||
|
|||||||
15
debian/changelog
vendored
15
debian/changelog
vendored
@ -1,3 +1,18 @@
|
|||||||
|
linux-patch-api (0.3.10-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Fix socket activation detection for service status healthy logic
|
||||||
|
* When service is inactive but enabled, check if .socket unit is active
|
||||||
|
|
||||||
|
-- Echo <echo@moon-dragon.us> Mon, 05 May 2026 13:10:00 -0500
|
||||||
|
|
||||||
|
linux-patch-api (0.3.9-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Fix socket activation detection for service status healthy logic
|
||||||
|
* When service is inactive but enabled, check if .socket unit is active
|
||||||
|
* Mark service healthy if socket is listening (e.g., ssh.socket for ssh.service)
|
||||||
|
|
||||||
|
-- Echo <echo@moon-dragon.us> Mon, 05 May 2026 11:25:00 -0500
|
||||||
|
|
||||||
linux-patch-api (0.3.8-1) unstable; urgency=low
|
linux-patch-api (0.3.8-1) unstable; urgency=low
|
||||||
|
|
||||||
* Add GET /api/v1/system/services/{name} endpoint for service health checks
|
* Add GET /api/v1/system/services/{name} endpoint for service health checks
|
||||||
|
|||||||
@ -568,6 +568,27 @@ fn get_systemd_service_status(name: &str) -> Result<Option<ServiceStatus>> {
|
|||||||
|
|
||||||
let healthy = active_state == "active" && sub_state == "running";
|
let healthy = active_state == "active" && sub_state == "running";
|
||||||
|
|
||||||
|
// 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"));
|
||||||
|
if let Ok(socket_output) = Command::new("systemctl")
|
||||||
|
.args(["show", &socket_name, "--property=ActiveState", "--no-pager"])
|
||||||
|
.output()
|
||||||
|
{
|
||||||
|
let socket_stdout = String::from_utf8_lossy(&socket_output.stdout);
|
||||||
|
if socket_stdout.contains("ActiveState=active") {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
healthy
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
healthy
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
healthy
|
||||||
|
};
|
||||||
|
|
||||||
Ok(Some(ServiceStatus {
|
Ok(Some(ServiceStatus {
|
||||||
name: id,
|
name: id,
|
||||||
display_name: description,
|
display_name: description,
|
||||||
|
|||||||
Reference in New Issue
Block a user