~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: John Arbash Meinel
  • Date: 2008-07-26 14:52:44 UTC
  • mto: This revision was merged to the branch mainline in revision 185.
  • Revision ID: john@arbash-meinel.com-20080726145244-l7h1ndtlu5mnm9tg
Add Copyright information to most files.

Fix the documentation for start/stop in the README.txt

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())