def stopServer(server=None): '''shutdown twemcache''' if server != None: server.terminate() time.sleep(SHUTDOWN_DELAY) print_verbose("Stopped twemcache instance, pid %d\n" % server.pid, VERBOSE)
def startServer(args=None): '''launch twemcache with a config file''' if args: if hasattr(args, 'config') and args.config: execfile(args.config) elif hasattr(args, 'command') and args.command: exec(args.command) options = [EXEC] for key in ARGS_UNARY.keys(): if eval(key): options.append(ARGS_UNARY[key]) for key in ARGS_BINARY.keys(): if eval(key) != None: options.append(ARGS_BINARY[key]) options.append(str(eval(key))) server = subprocess.Popen(options) time.sleep(INIT_DELAY) print_verbose("parameters: " + ' '.join(options), VERBOSE) print_verbose("Started twemcache instance, pid %d\n" % server.pid, VERBOSE) return server
def stopServer(server=None): '''shutdown twemcache''' if server != None: server.kill() time.sleep(SHUTDOWN_DELAY) print_verbose("Stopped twemcache instance, pid %d\n" % server.pid, VERBOSE)