~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: Jelmer Vernooij
  • Date: 2008-08-05 22:54:10 UTC
  • mfrom: (200 trunk)
  • mto: (197.1.9 pathargs)
  • mto: This revision was merged to the branch mainline in revision 202.
  • Revision ID: jelmer@samba.org-20080805225410-gwf3mvqdb79ggz5m
Merge trunk.

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
21
20
 
22
21
home = os.path.realpath(os.path.dirname(__file__))
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.')
 
22
pidfile = os.path.join(home, 'loggerhead.pid')
31
23
 
32
24
try:
33
 
    f = open(options.pidfile, 'r')
 
25
    f = open(pidfile, 'r')
34
26
except IOError, e:
35
 
    print 'Pid file %s not found.' % (options.pidfile,)
 
27
    print 'No pid file found.'
36
28
    sys.exit(1)
37
29
 
38
30
pid = int(f.readline())