From 4b3a4c7e4e997998e9e83ec8c8b29cc5649c2620 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Thu, 7 Nov 2019 13:48:42 +0100 Subject: [PATCH] Fetch the timestamp of the latest state change, not just the last time it got up and running... --- src/yunohost/service.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/yunohost/service.py b/src/yunohost/service.py index e3a584c41..850899ecc 100644 --- a/src/yunohost/service.py +++ b/src/yunohost/service.py @@ -293,7 +293,7 @@ def service_status(names=[]): result[name] = { 'status': "unknown", 'start_on_boot': "unknown", - 'active_at': "unknown", + 'last_state_change': "unknown", 'description': "Error: failed to get information for this service, it doesn't exists for systemd", 'configuration': "unknown", } @@ -314,7 +314,7 @@ def service_status(names=[]): result[name] = { 'status': str(status.get("SubState", "unknown")), 'start_on_boot': str(status.get("UnitFileState", "unknown")), - 'active_at': "unknown", + 'last_state_change': "unknown", 'description': description, 'configuration': "unknown", } @@ -324,8 +324,8 @@ def service_status(names=[]): if result[name]["start_on_boot"] == "generated": result[name]["start_on_boot"] = "enabled" if glob("/etc/rc[S5].d/S??"+name) else "disabled" - if "ActiveEnterTimestamp" in status: - result[name]['active_at'] = datetime.utcfromtimestamp(status["ActiveEnterTimestamp"] / 1000000) + if "StateChangeTimestamp" in status: + result[name]['last_state_change'] = datetime.utcfromtimestamp(status["StateChangeTimestamp"] / 1000000) # 'test-status' is an optional field to test the status of the service using a custom command if "test-status" in services[name]: