def start_master(config_path): """启动 master 模块 @param config_path : 配置文件路径 """ master = Master() master.config(config_path, 'src/start_server.py') master.start()
#coding:utf8 import os if os.name!='nt' and os.name!='posix': from twisted.internet import epollreactor epollreactor.install() if __name__=="__main__": from firefly.master.master import Master master = Master() master.config('config.json','appmain.py') master.start()
#coding:utf8 import os if os.name != 'nt': from twisted.internet import epollreactor epollreactor.install() if __name__ == "__main__": from firefly.master.master import Master master = Master() master.config('config.json', 'appmain.py') master.start()
if not debugSername: debugSername = raw_input("Debug Server Name:") cmds = 'python %s %s' % (os.path.basename(argv[0]), MASTER_SERVER_MODE) subprocess.Popen(cmds, shell=True) sleep(3) config = json.load(open('config.json', 'r')) sersconf = config.get('servers') for sername in sersconf.keys(): if sername == debugSername: continue cmds = 'python %s %s %s'%('appmain.py', sername, 'config.json') subprocess.Popen(cmds, shell=True) dbconf = config.get('db') memconf = config.get('memcached') sersconf = config.get('servers',{}) masterconf = config.get('master',{}) serconfig = sersconf.get(debugSername) ser = FFServer() ser.config(serconfig, servername=debugSername, dbconfig=dbconf, memconfig=memconf, masterconf=masterconf) ser.start() else: master = Master() master.config('config.json', 'appmain.py') master.masterapp() reactor.run()
#coding:utf8 import os from firefly.master.master import Master # if not NT and POSIX, use epoll if os.name != "nt" and os.name != "posix": from twisted.internet import epollreactor epollreactor.install() # start master, master will read config and start other server in subprocess if __name__ == "__main__": master = Master() master.config("config.json", "appmain.py") master.start()
# coding: utf8 """ 启动服务器 @name: startmaster.py @author: cbwfree @create: 15/12/29 20:02 """ import sys import os sys.path.append(os.path.abspath(os.path.dirname(__file__))) from firefly.master.master import Master, MULTI_SERVER_MODE from twisted.application import service import initialize APP_NAME = "firefly" APP_SCRIPT = "appmain.py" # 创建Application容器 application = service.Application(APP_NAME) # 创建守护进程 master = Master() master.set_script(APP_SCRIPT) # 设置启动脚本 master.set_mode(MULTI_SERVER_MODE) # 设置启动模式 master.start(application) # 启动守护进程
#coding:utf8 ''' Created on 2013-8-2 @author: lan (www.9miao.com) ''' import os if os.name!='nt': from twisted.internet import epollreactor epollreactor.install() def println(a): print a if __name__=="__main__": from firefly.master.master import Master master = Master() master.config('config.json','test_server_main.py') master.start()
# coding:utf8 """ Created on 2013-8-2 @author: lan """ import os if os.name != "nt": from twisted.internet import epollreactor epollreactor.install() def println(a): print a if __name__ == "__main__": from firefly.master.master import Master master = Master() master.config("config.json", "test_server_main.py") master.start()
if __name__ == "__main__": from firefly.master.master import Master master = Master() master.config('config.json', "appmain.py") master.start()
debugSername = raw_input("Debug Server Name:") cmds = 'python %s %s' % (os.path.basename(argv[0]), MASTER_SERVER_MODE) subprocess.Popen(cmds, shell=True) sleep(3) config = json.load(open('config.json', 'r')) sersconf = config.get('servers') for sername in sersconf.keys(): if sername == debugSername: continue cmds = 'python %s %s %s' % ('appmain.py', sername, 'config.json') subprocess.Popen(cmds, shell=True) dbconf = config.get('db') memconf = config.get('memcached') sersconf = config.get('servers', {}) masterconf = config.get('master', {}) serconfig = sersconf.get(debugSername) ser = FFServer() ser.config(serconfig, servername=debugSername, dbconfig=dbconf, memconfig=memconf, masterconf=masterconf) ser.start() else: master = Master() master.config('config.json', 'appmain.py') master.masterapp() reactor.run()