コード例 #1
0
def shutdown(x=None):
    """
    This is a top level method which control the process of finishing the
    program.

    Calls method ``shutdown()`` in other modules.
    """
    lg.out(2, "shutdowner.shutdown " + str(x))
    from services import driver
    from main import settings
    from main import events
    from logs import weblog
    from logs import webtraffic
    from system import tmpfile
    from system import run_upnpc
    from raid import eccmap
    from lib import net_misc
    from updates import git_proc
    from interface import api_jsonrpc_server
    from interface import api_rest_http_server
    from interface import ftp_server
    from userid import my_id
    from crypt import my_keys
    dl = []
    my_keys.shutdown()
    my_id.shutdown()
    ftp_server.shutdown()
    api_jsonrpc_server.shutdown()
    api_rest_http_server.shutdown()
    driver.shutdown()
    eccmap.shutdown()
    run_upnpc.shutdown()
    net_misc.shutdown()
    git_proc.shutdown()
    events.clear_subscribers()
    tmpfile.shutdown()
    if settings.NewWebGUI():
        from web import control
        dl.append(control.shutdown())
    else:
        from web import webcontrol
        dl.append(webcontrol.shutdown())
    weblog.shutdown()
    webtraffic.shutdown()
    for a in automat.objects().values():
        if a.name != 'shutdowner':
            a.event('shutdown')
    return DeferredList(dl)
コード例 #2
0
ファイル: shutdowner.py プロジェクト: codingcosmonaut/devel
def shutdown(x=None):
    """
    This is a top level method which control the process of finishing the
    program.

    Calls method ``shutdown()`` in other modules.
    """
    if _Debug:
        lg.out(_DebugLevel, "shutdowner.shutdown " + str(x))
    dl = []
    try:
        from services import driver
        from main import control
        from main import events
        from main import settings
        from logs import weblog
        from logs import webtraffic
        from system import tmpfile
        from system import run_upnpc
        from raid import eccmap
        from lib import net_misc
        from updates import git_proc
        from interface import api_jsonrpc_server
        from interface import api_rest_http_server
        from interface import api_web_socket
        from interface import ftp_server
        from userid import my_id
        from contacts import identitydb
        from crypt import my_keys
        my_keys.shutdown()
        my_id.shutdown()
        identitydb.shutdown()
        ftp_server.shutdown()
        api_jsonrpc_server.shutdown()
        api_rest_http_server.shutdown()
        api_web_socket.shutdown()
        driver.shutdown()
        eccmap.shutdown()
        run_upnpc.shutdown()
        net_misc.shutdown()
        git_proc.shutdown()
        events.shutdown()
        tmpfile.shutdown()
        control.shutdown()
        try:
            weblog.shutdown()
        except:
            lg.exc()
        try:
            webtraffic.shutdown()
        except:
            lg.exc()
        survived_automats = list(automat.objects().values())
        lg.warn(
            'found %d survived automats, sending "shutdown" event to them all'
            % len(survived_automats))
        for a in survived_automats:
            if a.name != 'shutdowner':
                a.event('shutdown')
        settings.shutdown()
    except:
        lg.exc()
    # TODO: rework all shutdown() methods to return deferred objects
    return DeferredList(dl)