server/serverctl.py
branchstable
changeset 5553 646737f80c88
parent 5424 8ecbcbff9777
child 5555 a64f48dd5fe4
child 5585 e1cbf6b304ea
equal deleted inserted replaced
5552:11175c77be9c 5553:646737f80c88
   523          {'short': 'D', 'action' : 'store_true',
   523          {'short': 'D', 'action' : 'store_true',
   524           'help': 'start server in debug mode.'}),
   524           'help': 'start server in debug mode.'}),
   525         )
   525         )
   526 
   526 
   527     def run(self, args):
   527     def run(self, args):
       
   528         from logilab.common.daemon import daemonize
   528         from cubicweb.server.server import RepositoryServer
   529         from cubicweb.server.server import RepositoryServer
   529         appid = pop_arg(args, msg='No instance specified !')
   530         appid = pop_arg(args, msg='No instance specified !')
   530         config = ServerConfiguration.config_for(appid)
   531         config = ServerConfiguration.config_for(appid)
   531         if sys.platform == 'win32':
   532         if sys.platform == 'win32':
   532             if not self.config.debug:
   533             if not self.config.debug:
   542         # ensure the directory where the pid-file should be set exists (for
   543         # ensure the directory where the pid-file should be set exists (for
   543         # instance /var/run/cubicweb may be deleted on computer restart)
   544         # instance /var/run/cubicweb may be deleted on computer restart)
   544         piddir = os.path.dirname(pidfile)
   545         piddir = os.path.dirname(pidfile)
   545         if not os.path.exists(piddir):
   546         if not os.path.exists(piddir):
   546             os.makedirs(piddir)
   547             os.makedirs(piddir)
   547         if not debug and server.daemonize(pidfile) == -1:
   548         if not debug and daemonize(pidfile) == -1:
   548             return
   549             return
   549         uid = config['uid']
   550         uid = config['uid']
   550         if uid is not None:
   551         if uid is not None:
   551             try:
   552             try:
   552                 uid = int(uid)
   553                 uid = int(uid)