diff --git a/media-dispatcher b/media-dispatcher index f31f72e..ad68c38 100644 --- a/media-dispatcher +++ b/media-dispatcher @@ -1,67 +1,67 @@ #!/usr/bin/env python # Copyright (C) 2008 AG Projects # """MediaProxy Dispatcher component""" if __name__ == "__main__": import sys from optparse import OptionParser from application.process import process, ProcessError from application.configuration import ConfigFile, datatypes from application import log import mediaproxy name = "media-dispatcher" fullname = "MediaProxy Dispatcher" description = "MediaProxy Dispatcher component" default_pid = mediaproxy.runtime_directory + '/dispatcher.pid' parser = OptionParser(version="%%prog %s" % mediaproxy.__version__) parser.add_option("--no-fork", action="store_false", dest="fork", default=1, help="run the process in the foreground (for debugging)") parser.add_option("--pid", dest="pid_file", default=default_pid, help="pid file (%s)" % default_pid, metavar="File") (options, args) = parser.parse_args() pid_file = options.pid_file process.system_config_directory = mediaproxy.system_config_directory config_file = ConfigFile(mediaproxy.configuration_filename) log.level.current = config_file.get_setting("Dispatcher", 'log_level', type=datatypes.LogLevel, default=log.level.DEBUG) try: process.runtime_directory = mediaproxy.runtime_directory except ProcessError, e: log.fatal("Cannot start %s: %s" % (fullname, e)) sys.exit(1) if options.fork: try: process.daemonize(pid_file) except ProcessError, e: log.fatal("Cannot start %s: %s" % (fullname, e)) sys.exit(1) log.start_syslog(name) log.msg("Starting %s %s" % (fullname, mediaproxy.__version__)) from mediaproxy.dispatcher import Dispatcher if not options.fork: - from application.debug.memory import * + from application.debug.memory import memory_dump try: dispatcher = Dispatcher() except Exception, e: log.fatal("failed to create %s: %s" % (fullname, e)) if e.__class__ is not RuntimeError: log.err() sys.exit(1) dispatcher.run() if not options.fork: - #from application.debug.memory import * + #from application.debug.memory import memory_dump memory_dump()