34
34
from loggerhead.trace import make_handler, setup_logging
35
35
from loggerhead.apps.error import ErrorHandlerApp
39
38
home = os.path.realpath(os.path.dirname(__file__))
40
39
default_pidfile = os.path.join(home, 'loggerhead.pid')
41
40
default_configfile = os.path.join(home, 'loggerhead.conf')
42
41
default_log_folder = os.path.join(home, 'logs')
43
42
parser = OptionParser(usage='usage: %prog [options]', version='%prog')
44
parser.add_option('-f', '--foreground',
45
action='store_true', dest='foreground', default=False,
43
parser.add_option('-f', '--foreground', action='store_true', dest='foreground', default=False,
46
44
help="run in the foreground; don't daemonize")
47
parser.add_option('-C', '--check', action='store_true',
48
dest='check', default=False,
49
help=("only start if not already running (useful for "
51
parser.add_option('-p', '--pidfile', dest="pidfile",
52
default=default_pidfile,
45
parser.add_option('-C', '--check', action='store_true', dest='check', default=False,
46
help="only start if not already running (useful for cron jobs)")
47
parser.add_option('-p', '--pidfile', dest="pidfile", default=default_pidfile,
53
48
type=str, help="override pidfile location")
54
parser.add_option('-c', '--config-file', dest="configfile",
55
default=default_configfile,
56
type=str, help="override configuration file location")
57
parser.add_option('-L', '--log-folder', dest="log_folder",
58
default=default_log_folder,
49
parser.add_option('-c', '--config-file', dest="configfile", default=default_configfile,
50
type=str, help="override configuration file location")
51
parser.add_option('-L', '--log-folder', dest="log_folder", default=default_log_folder,
59
52
type=str, help="override log file directory")
60
53
options, args = parser.parse_args()
76
67
sys.path.insert(0, extra_path)
78
potential_overrides = [('server.socket_port', int),
79
('server.webpath', str),
80
('server.thread_pool', int),
81
('server.socket_host', str)]
69
potential_overrides = [ ('server.socket_port', int),
70
('server.webpath', str),
71
('server.thread_pool', int),
72
('server.socket_host' ,str) ]
82
73
server_port = int(config.get('server.socket_port', 8080))
83
74
nworkers = int(config.get('server.thread_pool', 10))
84
75
server_host = config.get('server.socket_host', '0.0.0.0')