Exemplo n.º 1
0
def start():
    if is_already_started():
        print 'instance already existing'
        return
    
    # read config
    config = ConfigParser.ConfigParser()
    config.read('udp_tracker_server.config.txt')
    port = config.get( "tracker" , "tracker.udp_port")
    
    # start two threads
    s_thread = submitter_thread()
    m_thread = monitor_thread(lock_file , s_thread)
    
    s_thread.tracker_port_ = int(port)
    
    m_thread.start()
    s_thread.start()
    
    m_thread.join()
    s_thread.join()

    if lock_file != None:
        lock_file.close()
        
    os.remove( '.lock' )
Exemplo n.º 2
0
def start():
    if process_manager.check_process() == False:
         sys.exit(0)
    process_manager.record_pid(str(os.getpid()))
    u_thread = config_update_thread()
    u_thread.start()
    while u_thread.config_updated_ == False:
        if not u_thread.isAlive():
            print 'update config thread is dead!!!'
            sys.exit(-1)
        else:
            time.sleep(1)

    m_thread = monitor_thread.monitor_thread()
    s_thread = submitter_thread.submitter_thread()

    m_thread.start()
    s_thread.start()

    m_thread.join()
    s_thread.join()
    u_thread.join()