Last active
August 29, 2015 14:05
-
-
Save overplumbum/b1482e46ea7b5b9d3384 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2.7 -u | |
from os.path import basename, join, dirname | |
from glob import glob | |
from pprint import pprint as pp | |
for proc in glob('/proc/*/status'): | |
try: | |
meta = dict(line.split(':\t', 1) for line in open(proc).read().splitlines()) | |
except IOError: | |
continue | |
if int(meta['PPid']) != 1: | |
continue | |
cgroup = open(join(dirname(proc), 'cgroup')).read().splitlines() | |
cgroup = dict(line.split(':', 2)[1:] for line in cgroup) | |
if cgroup['memory'] != '/': | |
print('{}\t{}'.format(meta['Pid'], meta['Name'])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment