From 31e8c4acee28296fe9898bf9ecbc323c8b931d39 Mon Sep 17 00:00:00 2001 From: brent s Date: Fri, 18 Jan 2019 15:41:10 -0500 Subject: [PATCH] i think i figured it out... i need the *parent* pid, not the pid itself. https://raamdev.com/2007/kill-inactive-and-idle-linux-users/ --- sys/user_cull.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/user_cull.py b/sys/user_cull.py index 9ba936f..98ecd3a 100755 --- a/sys/user_cull.py +++ b/sys/user_cull.py @@ -106,7 +106,7 @@ for user in psutil.users(): 'timeout': timeout} fmtd_goodbye = goodbye_mesg.format(**fmt_vals) if only_ssh: - if user.pid in ssh_pids: + if psutil.Process(user.pid).ppid() in ssh_pids: if goodbye: subprocess.run(['write', user.name,