--- 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):
--- 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:
--- 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'
--- 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):