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/

This commit is contained in:
brent s 2019-01-18 15:41:10 -05:00
parent c55b844ad1
commit 31e8c4acee
1 changed files with 1 additions and 1 deletions

View File

@ -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,