diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-23 07:10:19 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2012-05-23 07:10:19 +0000 |
commit | 3e152ec2a0809d8e4f633b61f012ff7179e6ac7f (patch) | |
tree | 3d1613b8e0bc543fe817b341edcfd92cd64a1907 /contrib | |
parent | b3d9661ee98a67d716eccded939690caedd7f271 (diff) | |
download | gnunet-3e152ec2a0809d8e4f633b61f012ff7179e6ac7f.tar.gz gnunet-3e152ec2a0809d8e4f633b61f012ff7179e6ac7f.zip |
LRN's patch
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/gnunet_janitor.py.in | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/gnunet_janitor.py.in b/contrib/gnunet_janitor.py.in index c11ff4f12..f68ff1cb2 100644 --- a/contrib/gnunet_janitor.py.in +++ b/contrib/gnunet_janitor.py.in | |||
@@ -44,7 +44,10 @@ def get_process_list (): | |||
44 | else: | 44 | else: |
45 | pids = [pid for pid in os.listdir('/proc') if pid.isdigit ()] | 45 | pids = [pid for pid in os.listdir('/proc') if pid.isdigit ()] |
46 | for pid in pids: | 46 | for pid in pids: |
47 | result.append ((pid, open (os.path.join ('/proc', pid, 'comm'), 'rb').read ())) | 47 | with open (os.path.join ('/proc', pid, 'cmdline'), 'rb') as p: |
48 | cmdline = p.read ().split ('\x00') | ||
49 | if len (cmdline) > 0: | ||
50 | result.append ((pid, cmdline[0])) | ||
48 | return result | 51 | return result |
49 | 52 | ||
50 | def main (): | 53 | def main (): |
@@ -57,7 +60,7 @@ def main (): | |||
57 | if re.match (r'gnunet-service-arm', p[1]): | 60 | if re.match (r'gnunet-service-arm', p[1]): |
58 | print ("killing arm process {0:5} {1}".format (p[0], p[1])) | 61 | print ("killing arm process {0:5} {1}".format (p[0], p[1])) |
59 | try: | 62 | try: |
60 | os.kill (p[0], signal.SIGTERM) | 63 | os.kill (int (p[0]), signal.SIGKILL) |
61 | except OSError as e: | 64 | except OSError as e: |
62 | print ("failed: {0}".format (e)) | 65 | print ("failed: {0}".format (e)) |
63 | pass | 66 | pass |
@@ -65,7 +68,7 @@ def main (): | |||
65 | if not re.match (r'gnunet-service-arm', p[1]): | 68 | if not re.match (r'gnunet-service-arm', p[1]): |
66 | print ("killing non-arm process {0:5} {1}".format (p[0], p[1])) | 69 | print ("killing non-arm process {0:5} {1}".format (p[0], p[1])) |
67 | try: | 70 | try: |
68 | os.kill (p[0], signal.SIGTERM) | 71 | os.kill (int (p[0]), signal.SIGKILL) |
69 | except OSError as e: | 72 | except OSError as e: |
70 | print ("failed: {0}".format (e)) | 73 | print ("failed: {0}".format (e)) |
71 | pass | 74 | pass |