def start_tracker():
    """Start the Torrent Tracker.
    """
    # parse commandline options
    parser = OptionParser()
    parser.add_option('-p', '--port', help='Tracker Port', default=0)
    parser.add_option('-b', '--background', action='store_true',
                      default=False, help='Start in background')
    parser.add_option('-d', '--debug', action='store_true',
                      default=False, help='Debug mode')
    (options, args) = parser.parse_args()

    # setup directories
    create_pytt_dirs()
    # setup logging
    setup_logging(options.debug)

    try:
        # start the torrent tracker
        run_app(int(options.port) or get_config().getint('tracker', 'port'))
    except __HOLE__:
        logging.info('Tracker Stopped.')
        close_db()
        sys.exit(0)
    except Exception as ex:
        logging.fatal('%s' % str(ex))
        close_db()
        sys.exit(-1)
dataset/ETHPy150Open semk/Pytt/pytt/tracker.py/start_tracker