~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to start-loggerhead

  • Committer: Jelmer Vernooij
  • Date: 2008-08-06 18:27:51 UTC
  • mto: (197.1.9 pathargs)
  • mto: This revision was merged to the branch mainline in revision 202.
  • Revision ID: jelmer@samba.org-20080806182751-s68wtdpxaryvylhp
Add --configfile argument.

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
def main():
79
79
    home = os.path.realpath(os.path.dirname(__file__))
80
80
    default_pidfile = os.path.join(home, 'loggerhead.pid')
 
81
    default_configfile = os.path.join(home, 'loggerhead.conf')
81
82
    parser = OptionParser(usage='usage: %prog [options]', version='%prog ' + release.version)
82
83
    parser.add_option('-f', '--foreground', action='store_true', dest='foreground', default=False,
83
84
                      help="run in the foreground; don't daemonize")
85
86
                      help="only start if not already running (useful for cron jobs)")
86
87
    parser.add_option('-p', '--pidfile', dest="pidfile", default=default_pidfile,
87
88
                      help="override pidfile location")
 
89
    parser.add_option('-c', '--configfile', dest="configfile", default=default_configfile,
 
90
                      help="override configuration file location")
88
91
    options, args = parser.parse_args()
89
92
    if len(args) > 0:
90
93
        parser.error('No filename arguments are used, only options.')
96
99
 
97
100
    # read loggerhead config
98
101
 
99
 
    config = ConfigObj(os.path.join(home, 'loggerhead.conf'), encoding='utf-8')
 
102
    config = ConfigObj(options.configfile, encoding='utf-8')
100
103
    extra_path = config.get('bzrpath', None)
101
104
    if extra_path:
102
105
        sys.path.insert(0, extra_path)