# HG changeset patch # User Sylvain Thénault # Date 1294237957 -3600 # Node ID 7dd4835d5198d2a3982abbcb59ad935e57eb26f1 # Parent 1d423b7aa6c96ba4820641dba61aa4742631af21 properly tell we've started an instance (close #1391262) diff -r 1d423b7aa6c9 -r 7dd4835d5198 cwctl.py --- a/cwctl.py Thu Dec 23 15:49:29 2010 +0100 +++ b/cwctl.py Wed Jan 05 15:32:37 2011 +0100 @@ -494,7 +494,8 @@ msg = "%s seems to be running. Remove %s by hand if necessary or use \ the --force option." raise ExecutionError(msg % (appid, pidf)) - helper.start_server(config) + if helper.start_server(config) == 1: + print 'instance %s started' % appid def init_cmdline_log_threshold(config, loglevel): diff -r 1d423b7aa6c9 -r 7dd4835d5198 etwist/server.py --- a/etwist/server.py Thu Dec 23 15:49:29 2010 +0100 +++ b/etwist/server.py Wed Jan 05 15:32:37 2011 +0100 @@ -415,8 +415,9 @@ "commands (e.g : 'net start my_instance)'") from logilab.common.daemon import daemonize LOGGER.info('instance started in the background on %s', root_resource.base_url) - if daemonize(config['pid-file']): - return # child process + whichproc = daemonize(config['pid-file']) + if whichproc: # 1 = orig process, 2 = first fork, None = second fork (eg daemon process) + return whichproc # parent process root_resource.init_publisher() # before changing uid if config['uid'] is not None: try: diff -r 1d423b7aa6c9 -r 7dd4835d5198 etwist/twctl.py --- a/etwist/twctl.py Thu Dec 23 15:49:29 2010 +0100 +++ b/etwist/twctl.py Wed Jan 05 15:32:37 2011 +0100 @@ -32,7 +32,7 @@ def start_server(self, config): from cubicweb.etwist import server - server.run(config) + return server.run(config) class TWStopHandler(CommandHandler): cmdname = 'stop' diff -r 1d423b7aa6c9 -r 7dd4835d5198 server/serverctl.py --- a/server/serverctl.py Thu Dec 23 15:49:29 2010 +0100 +++ b/server/serverctl.py Wed Jan 05 15:32:37 2011 +0100 @@ -237,6 +237,7 @@ command.append('--loglevel %s' % config['log-threshold'].lower()) command.append(config.appid) os.system(' '.join(command)) + return 1 class RepositoryStopHandler(CommandHandler):