~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: Matt Nordhoff
  • Date: 2009-10-17 06:56:04 UTC
  • mto: This revision was merged to the branch mainline in revision 406.
  • Revision ID: mnordhoff@mattnordhoff.com-20091017065604-fbphg8b8ih9ongsd
Remove new trailing whitespace

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