diff options
Diffstat (limited to 'client_ls.py')
| -rwxr-xr-x[-rw-r--r--] | client_ls.py | 10 |
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() |
