10637.3.15
by Guilherme Salgado
update the shebang lines of a few scripts that still had python2.5 hard-coded |
1 |
#!/usr/bin/python -S
|
9590.1.135
by Michael Hudson
add files from launchpad-loggerhead tree to launchpad tree |
2 |
#
|
3 |
# Copyright 2009, 2010 Canonical Ltd. This software is licensed under the
|
|
4 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
5 |
||
6 |
import _pythonpath |
|
7 |
||
8 |
import os |
|
9 |
import sys |
|
10 |
||
14612.2.7
by William Grant
scripts |
11 |
|
9590.1.135
by Michael Hudson
add files from launchpad-loggerhead tree to launchpad tree |
12 |
home = os.path.realpath(os.path.dirname(__file__)) |
13 |
pidfile = os.path.join(home, 'loggerhead.pid') |
|
14 |
||
15 |
try: |
|
16 |
f = open(pidfile, 'r') |
|
17 |
except IOError, e: |
|
18 |
print 'No pid file found.' |
|
19 |
sys.exit(1) |
|
20 |
||
21 |
pid = int(f.readline()) |
|
22 |
||
23 |
try: |
|
24 |
os.kill(pid, 0) |
|
25 |
except OSError, e: |
|
26 |
print 'Stale pid file; server is not running.' |
|
27 |
sys.exit(1) |
|
28 |
||
29 |
print
|
|
30 |
print 'Shutting down previous server @ pid %d.' % (pid,) |
|
31 |
print
|
|
32 |
||
33 |
import signal |
|
34 |
os.kill(pid, signal.SIGTERM) |