Show More
@@ -78,18 +78,20 b' def killdaemons(pidfile, tryhard=True, r' | |||
|
78 | 78 | logfn = lambda s: s |
|
79 | 79 | # Kill off any leftover daemon processes |
|
80 | 80 | try: |
|
81 | fp = open(pidfile) | |
|
82 | for line in fp: | |
|
83 |
|
|
|
84 |
|
|
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
|
88 | logfn('# Not killing daemon process %s - invalid pid' | |
|
89 | % line.rstrip()) | |
|
90 | continue | |
|
81 | pids = [] | |
|
82 | with open(pidfile) as fp: | |
|
83 | for line in fp: | |
|
84 | try: | |
|
85 | pid = int(line) | |
|
86 | if pid <= 0: | |
|
87 | raise ValueError | |
|
88 | except ValueError: | |
|
89 | logfn('# Not killing daemon process %s - invalid pid' | |
|
90 | % line.rstrip()) | |
|
91 | continue | |
|
92 | pids.append(pid) | |
|
93 | for pid in pids: | |
|
91 | 94 | kill(pid, logfn, tryhard) |
|
92 | fp.close() | |
|
93 | 95 | if remove: |
|
94 | 96 | os.unlink(pidfile) |
|
95 | 97 | except IOError: |
General Comments 0
You need to be logged in to leave comments.
Login now