~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: Jelmer Vernooij
  • Date: 2008-08-06 18:39:15 UTC
  • mto: (197.1.9 pathargs)
  • mto: This revision was merged to the branch mainline in revision 202.
  • Revision ID: jelmer@samba.org-20080806183915-81q0zlnxq57s0egb
Add --pidfile option to stop-loggerhead.

Show diffs side-by-side

added added

removed removed

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