summaryrefslogtreecommitdiff
path: root/client_ls.py
diff options
context:
space:
mode:
authorhc <hc@email.ch>2025-02-01 11:07:07 +0800
committerhc <hc@email.ch>2025-02-01 11:07:07 +0800
commit8c1a40d00ca69f2194a9f7c4cf4e884a2d225d3d (patch)
tree2c880e936b465915ea6483fe2737a55b9638923b /client_ls.py
parent6e2bd1f5053f5244d1294ba5ae2c0ffc047743b6 (diff)
formatednicely
Diffstat (limited to 'client_ls.py')
-rwxr-xr-x[-rw-r--r--]client_ls.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/client_ls.py b/client_ls.py
index 6aa3a7e..fdcfc78 100644..100755
--- a/client_ls.py
+++ b/client_ls.py
@@ -1,4 +1,4 @@
-
+#!/usr/bin/env python3
#lists client information
import fcntl
@@ -12,10 +12,14 @@ def read_data():
# Get shared lock for reading
fcntl.flock(f.fileno(), fcntl.LOCK_SH)
try:
- return json.load(f)
+ data = json.load(f)
+ for pid, info in data.items():
+ print(info)
+ return {}
finally:
fcntl.flock(f.fileno(), fcntl.LOCK_UN)
except (FileNotFoundError, ValueError):
+ print("file /tmp/ssh_sessions.json not found")
return {}
-print(read_data())
+read_data()