mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix loaded status for sysv services
This commit is contained in:
parent
fcede4f9ce
commit
69d2ad9a8a
1 changed files with 7 additions and 0 deletions
|
@ -31,6 +31,7 @@ import subprocess
|
||||||
import shutil
|
import shutil
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
from difflib import unified_diff
|
from difflib import unified_diff
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
@ -330,6 +331,12 @@ def service_status(names=[]):
|
||||||
'description': description,
|
'description': description,
|
||||||
'service_file_path': str(status.get("FragmentPath", "unknown")),
|
'service_file_path': str(status.get("FragmentPath", "unknown")),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Fun stuff™ : to obtain the enabled/disabled status for sysv services,
|
||||||
|
# gotta do this ... cf code of /lib/systemd/systemd-sysv-install
|
||||||
|
if result[name]["loaded"] == "generated":
|
||||||
|
result[name]["loaded"] = "enabled" if glob("/etc/rc[S5].d/S??"+name) else "disabled"
|
||||||
|
|
||||||
if "ActiveEnterTimestamp" in status:
|
if "ActiveEnterTimestamp" in status:
|
||||||
result[name]['active_at'] = datetime.utcfromtimestamp(status["ActiveEnterTimestamp"] / 1000000)
|
result[name]['active_at'] = datetime.utcfromtimestamp(status["ActiveEnterTimestamp"] / 1000000)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue