def update_scene_conf(self): myres = xlresource.resource_singleton() mysql_conn = myres.mysql_pool.get() alldata = () try: mysql_conn.ping(True) except Exception, e: myres.mysql_pool.put(mysql_conn) return None
if __name__ == '__main__': while True: try: unsure_pid = os.fork() if 0 == unsure_pid: # 子进程 break else: # 父进程 try: os.waitpid(unsure_pid, 0) except OSError, e: print 'waitpid error!! you need reboot server again!!' sys.exit(1) print 'child process exit, restart child process' except OSError, e: print 'fork error!! you need reboot server again!!' sys.exit(1) logger_init('../conf/logger.conf', ['root', 'service', 'run']) xlresource.resource_singleton() print 'service', '<===============service begin!!!=================> ' LOG_INFO( 'run', '<===============service begin!!!=================> ' + get_vrun_info()) LOG_INFO( 'service', '<===============service begin!!!=================> ' + get_vrun_info()) mysvr = httpserver.httpserver() mysvr.start_server()