Skip to content

Instantly share code, notes, and snippets.

@mfournier
Created February 26, 2016 11:47
Show Gist options
  • Save mfournier/ca6a1decd63db0ce8c67 to your computer and use it in GitHub Desktop.
Save mfournier/ca6a1decd63db0ce8c67 to your computer and use it in GitHub Desktop.
sudo lsof | awk -f scan-processes.awk
{
if ($4 ~ /^DEL$/) {
sub(".#prelink#.*", "", $8)
mappings[$8]++
processes[$1]++
}
}
END {
for (j in mappings) {
print "file",j,"has "mappings[j]" dangling reference(s)"
}
for (i in processes) {
print "process",i,"has "processes[i]" deleted mapping(s)"
}
print length(processes),"processes need restarting"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment