equal
deleted
inserted
replaced
|
1 #!/usr/bin/env python |
|
2 |
|
3 import os, sys, time, errno, signal |
|
4 |
|
5 # Kill off any leftover daemon processes |
|
6 try: |
|
7 fp = file(os.environ['DAEMON_PIDS']) |
|
8 for line in fp: |
|
9 try: |
|
10 pid = int(line) |
|
11 except ValueError: |
|
12 continue |
|
13 try: |
|
14 os.kill(pid, 0) |
|
15 os.kill(pid, signal.SIGTERM) |
|
16 for i in range(10): |
|
17 time.sleep(0.05) |
|
18 os.kill(pid, 0) |
|
19 os.kill(pid, signal.SIGKILL) |
|
20 except OSError, err: |
|
21 if err.errno != errno.ESRCH: |
|
22 raise |
|
23 fp.close() |
|
24 except IOError: |
|
25 pass |