コード例 #1
0
ファイル: server.py プロジェクト: jeekl/hydrus
            'server stop - stops an existing instance of this server')
        HydrusData.Print(
            'server restart - stops an existing instance of this server, then runs itself'
        )
        HydrusData.Print('')
        HydrusData.Print(
            'You can also run \'server\' without arguments. Depending on what is going on, it will try to start or it will ask you if you want to stop or restart.'
        )
        HydrusData.Print(
            'You can also stop the running server just by hitting Ctrl+C.')

    else:

        log_path = os.path.join(HC.DB_DIR, 'server.log')

        with HydrusLogger.HydrusLogger(log_path) as logger:

            try:

                if action in ('stop', 'restart'):

                    ServerController.ShutdownSiblingInstance()

                if action in ('start', 'restart'):

                    HydrusData.Print('Initialising controller...')

                    threading.Thread(target=reactor.run,
                                     kwargs={
                                         'installSignalHandlers': 0
                                     }).start()
コード例 #2
0
ファイル: client.py プロジェクト: KobraKid/hydrus
    with open(dest_path, 'w', encoding='utf-8') as f:

        f.write(error_trace)

    print(
        'Critical boot error occurred! Details written to hydrus_crash.log in either db dir or user dir!'
    )

    import sys

    sys.exit(1)

controller = None

with HydrusLogger.HydrusLogger(db_dir, 'client') as logger:

    try:

        HydrusData.Print('hydrus client started')

        if not HG.twisted_is_broke:

            import threading

            threading.Thread(target=reactor.run,
                             name='twisted',
                             kwargs={
                                 'installSignalHandlers': 0
                             }).start()
コード例 #3
0
    dest_path = os.path.join( emergency_dir, 'hydrus_crash.log' )
    
    with open( dest_path, 'w', encoding = 'utf-8' ) as f:
        
        f.write( error_trace )
        
    
    print( 'Critical boot error occurred! Details written to hydrus_crash.log in either db dir or user dir!' )
    
    import sys
    
    sys.exit( 1 )
    
controller = None

with HydrusLogger.HydrusLogger( db_dir, 'server' ) as logger:
    
    try:
        
        if action in ( 'stop', 'restart' ):
            
            ServerController.ShutdownSiblingInstance( db_dir )
            
        
        if action in ( 'start', 'restart' ):
            
            HydrusData.Print( 'Initialising controller\u2026' )
            
            threading.Thread( target = reactor.run, name = 'twisted', kwargs = { 'installSignalHandlers' : 0 } ).start()
            
            controller = ServerController.Controller( db_dir )
コード例 #4
0
ファイル: server.py プロジェクト: wlerin/hydrus
 action = ServerController.GetStartingAction()
 
 if action == 'help':
 
     HydrusData.Print( 'This is the hydrus server. It accepts these commands:' )
     HydrusData.Print( '' )
     HydrusData.Print( 'server start - runs the server' )
     HydrusData.Print( 'server stop - stops an existing instance of this server' )
     HydrusData.Print( 'server restart - stops an existing instance of this server, then runs itself' )
     HydrusData.Print( '' )
     HydrusData.Print( 'You can also run \'server\' without arguments. Depending on what is going on, it will try to start or it will ask you if you want to stop or restart.' )
     HydrusData.Print( 'You can also stop the running server just by hitting Ctrl+C.')
     
 else:
     
     with HydrusLogger.HydrusLogger( 'server.log' ) as logger:
         
         try:
             
             if action in ( 'stop', 'restart' ):
                 
                 ServerController.ShutdownSiblingInstance()
                 
             
             if action in ( 'start', 'restart' ):
                 
                 HydrusData.Print( 'Initialising controller...' )
                 
                 threading.Thread( target = reactor.run, kwargs = { 'installSignalHandlers' : 0 } ).start()
                 
                 controller = ServerController.Controller()