~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to stop-loggerhead

  • Committer: Martin Albisetti
  • Date: 2008-07-31 04:16:57 UTC
  • mto: This revision was merged to the branch mainline in revision 188.
  • Revision ID: argentina@gmail.com-20080731041657-0lk9tqbsjyz1mf5r
 * Removed unused imports
 * Removed checking for dependencies
 * Removed unnecessary install class

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())
44
39
    sys.exit(1)
45
40
 
46
41
print
47
 
print 'Shutting down previous server @ pid %d.' % pid
 
42
print 'Shutting down previous server @ pid %d.' % (pid,)
48
43
print
49
44
 
50
45
import signal