mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fetch the timestamp of the latest state change, not just the last time it got up and running...
This commit is contained in:
parent
acba0c4a10
commit
4b3a4c7e4e
1 changed files with 4 additions and 4 deletions
|
@ -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]:
|
||||
|
|
Loading…
Add table
Reference in a new issue