From 9dc3e414bef73a14dede00b3aaf84a2c10bd71f1 Mon Sep 17 00:00:00 2001 From: Michael Kuron Date: Fri, 21 Oct 2016 10:03:28 +0200 Subject: [PATCH] Sierra processes --- README.md | 5 +++-- mountclean.py | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9b4f9cc..d264e60 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ mountclean ========== This is a daemon for Mac OS X which periodically checks for leftover mounts of Network Home Directories and for stale processes belonging to users which are no longer logged in. -In a way, this resembles what [uphclean](http://www.microsoft.com/de-de/download/details.aspx?id=6676) did for Windows 2000/XP: it makes sure that when a user logs out, the session really ends. This is necessary so that no files are still locked when the user later logs into a different client machine. It is also useful in environments where many users share a single computer and you would otherwise end up with dozens of leftover home mounts and hundreds of stale processes. +In a way, this resembles what [uphclean](https://support.microsoft.com/en-us/kb/837115) did for Windows 2000/XP: it makes sure that when a user logs out, the session really ends. This is necessary so that no files are still locked when the user later logs into a different client machine. It is also useful in environments where many users share a single computer and you would otherwise end up with dozens of leftover home mounts and hundreds of stale processes. The script is run every two minutes and checks for mounts in /home. For each one, it checks whether the corresponding user has any processes running. If he only has background processes (names listed in the script) running, these are terminated and the home directory is unmounted. So processes and mounts belonging to a user currently logged in locally or via SSH are never touched. Also, users who e.g. started screen sessions before logging out are not touched. @@ -33,4 +33,5 @@ Troubleshooting Good places to look when things don't work as expected are: - Mounted home directories: `ls /home` - Running processes: `ps axu | grep -v '^root\|^_'` -- Log output written by mountclean: `grep mountclean /var/log/system.log` +- Log output written by mountclean: `grep mountclean /var/log/system.log` (only on OS X 10.11.6 and below) +- Output from running mountclean: `sudo mountclean.py` diff --git a/mountclean.py b/mountclean.py index 308c990..77e9e34 100755 --- a/mountclean.py +++ b/mountclean.py @@ -73,6 +73,12 @@ def log(msg): 'GPUToolsAgent', 'com.apple.MailSe', 'com.apple.spotli', + 'nsurlstoraged', + # new in Sierra + 'trustd', + 'lsd', + 'com.apple.Dictio', + 'CalNCService', # Dropbox client 'Dropbox', 'dbfseventsd', @@ -106,7 +112,7 @@ def log(msg): ps = ps.splitlines() ps = [p.strip() for p in ps[1:]] extraps = set(ps)-set(killprocs) - log("%d processes still running: %s" % (len(extraps), ", ".join(extraps))) + log("%d processes still running for %s: %s" % (len(extraps), user, ", ".join(extraps))) if len(extraps) == 0: kill_users.append(user)