mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[enh] get since how much time a service is running
This commit is contained in:
parent
1b774527d8
commit
0011c4ab56
1 changed files with 6 additions and 0 deletions
|
@ -31,7 +31,9 @@ import subprocess
|
||||||
import errno
|
import errno
|
||||||
import shutil
|
import shutil
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from difflib import unified_diff
|
from difflib import unified_diff
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from moulinette import m18n
|
from moulinette import m18n
|
||||||
from moulinette.core import MoulinetteError
|
from moulinette.core import MoulinetteError
|
||||||
|
@ -218,6 +220,10 @@ def service_status(names=[]):
|
||||||
'status': str(status.get("SubState", "unknown")),
|
'status': str(status.get("SubState", "unknown")),
|
||||||
'loaded': str(status.get("LoadState", "unknown")),
|
'loaded': str(status.get("LoadState", "unknown")),
|
||||||
'active': str(status.get("ActiveState", "unknown")),
|
'active': str(status.get("ActiveState", "unknown")),
|
||||||
|
'active_at': {
|
||||||
|
"timestamp": str(status.get("ActiveEnterTimestamp", "unknown")),
|
||||||
|
"human": datetime.fromtimestamp(status.get("ActiveEnterTimestamp") / 1000000).strftime("%F %X"),
|
||||||
|
},
|
||||||
'description': str(status.get("Description", "")),
|
'description': str(status.get("Description", "")),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue