Merge branch 'main' of https://git.xpub.nl/vitrinekast/tl-dr
commit
a9ebfec3b6
@ -0,0 +1,18 @@
|
|||||||
|
import json
|
||||||
|
import subprocess
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
## creating the JSON
|
||||||
|
|
||||||
|
## grabbing the logged in users since yesterday
|
||||||
|
last_here = subprocess.run(["last", "-s", "today"], capture_output=True)
|
||||||
|
logged_in_today = subprocess.run(["sudo journalctl -S yesterday _COMM=systemd-logind -o json"], capture_output=True)
|
||||||
|
output = json.loads(last_here)
|
||||||
|
|
||||||
|
print(output)
|
||||||
|
|
||||||
|
today = datetime.today().strftime('%Y-%m-%d-%H:%M:%S')
|
||||||
|
|
||||||
|
with open("data_" + today + ".json", 'w') as f:
|
||||||
|
print(output, file = f)
|
||||||
|
|
Loading…
Reference in New Issue