示例#1
0
def start():
    print("[*] Starting server..")

    try:
        if check_pid(read_pid()):
            print("[!] Process already started!")
            return
    except:
        pass

    try:
        modules.load_all()
        sockets.spawn_all()
    except Exception as e:
        print("[!] Server boot failed: %s" % e)
        return

    print("[*] Server successfully started.")

    if os.fork():
        quit()
    if os.fork():
        quit()

    write_pid()

    os.setsid()

    sys.stdout = open("/dev/null", "w")
    sys.stderr = open("data/errors", "w")
    sys.stdin = open("/dev/null")

    sockets.serve()
示例#2
0
 def reload(self, signum=None, frame=None):
     config.load_config()
     sockets.spawn_all()
     events.unregister_all()
     modules.load_all()