~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: Tim Penhey
  • Date: 2008-08-01 04:42:14 UTC
  • mto: This revision was merged to the branch mainline in revision 190.
  • Revision ID: tim.penhey@canonical.com-20080801044214-9vtocnww36dnddne
Extend serve-branches to serve user dirs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
"""A script for stopping the loggerhead process."""
17
17
 
 
18
import pkg_resources
 
19
pkg_resources.require("TurboGears")
 
20
 
18
21
import os
19
22
import sys
20
 
from optparse import OptionParser
21
23
 
22
24
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.')
 
25
pidfile = os.path.join(home, 'loggerhead.pid')
31
26
 
32
27
try:
33
 
    f = open(options.pidfile, 'r')
 
28
    f = open(pidfile, 'r')
34
29
except IOError, e:
35
 
    print 'Pid file %s not found.' % (options.pidfile,)
 
30
    print 'No pid file found.'
36
31
    sys.exit(1)
37
32
 
38
33
pid = int(f.readline())