~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: Michael Hudson
  • Date: 2008-10-01 20:02:14 UTC
  • mfrom: (227.1.1 loggerhead.python2.4)
  • Revision ID: michael.hudson@canonical.com-20081001200214-15go6vse1cklf345
restore python2.4 compatibility (Marius Kruger)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import os
19
19
import sys
 
20
from optparse import OptionParser
20
21
 
21
22
home = os.path.realpath(os.path.dirname(__file__))
22
 
pidfile = os.path.join(home, 'loggerhead.pid')
 
23
default_pidfile = os.path.join(home, 'loggerhead.pid')
 
24
parser = OptionParser(usage='usage: %prog [options]', version='%prog')
 
25
parser.add_option('-p', '--pidfile', dest="pidfile", default=default_pidfile,
 
26
                                  help="override pidfile location")
 
27
 
 
28
options, args = parser.parse_args()
 
29
if len(args) > 0:
 
30
        parser.error('No filename arguments are used, only options.')
23
31
 
24
32
try:
25
 
    f = open(pidfile, 'r')
 
33
    f = open(options.pidfile, 'r')
26
34
except IOError, e:
27
 
    print 'No pid file found.'
 
35
    print 'Pid file %s not found.' % options.pidfile
28
36
    sys.exit(1)
29
37
 
30
38
pid = int(f.readline())