server/serverctl.py
changeset 8236 cc70da744f43
parent 8233 9b9180969892
child 8350 e1c05bf6fdeb
equal deleted inserted replaced
8230:00435a332502 8236:cc70da744f43
    23 # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash
    23 # possible (for cubicweb-ctl reactivity, necessary for instance for usable bash
    24 # completion). So import locally in command helpers.
    24 # completion). So import locally in command helpers.
    25 import sys
    25 import sys
    26 import os
    26 import os
    27 import logging
    27 import logging
       
    28 import subprocess
    28 
    29 
    29 from logilab.common import nullobject
    30 from logilab.common import nullobject
    30 from logilab.common.configuration import Configuration
    31 from logilab.common.configuration import Configuration
    31 from logilab.common.shellutils import ASK, generate_password
    32 from logilab.common.shellutils import ASK, generate_password
    32 
    33 
   256 class RepositoryStartHandler(CommandHandler):
   257 class RepositoryStartHandler(CommandHandler):
   257     cmdname = 'start'
   258     cmdname = 'start'
   258     cfgname = 'repository'
   259     cfgname = 'repository'
   259 
   260 
   260     def start_server(self, config):
   261     def start_server(self, config):
   261         command = ['cubicweb-ctl start-repository ']
   262         command = ['cubicweb-ctl', 'start-repository']
   262         if config.debugmode:
   263         if config.debugmode:
   263             command.append('--debug')
   264             command.append('--debug')
   264         command.append('--loglevel %s' % config['log-threshold'].lower())
   265         command.append('--loglevel')
       
   266         command.append(config['log-threshold'].lower())
   265         command.append(config.appid)
   267         command.append(config.appid)
   266         os.system(' '.join(command))
   268         subprocess.call(command)
   267         return 1
   269         return 1
   268 
   270 
   269 
   271 
   270 class RepositoryStopHandler(CommandHandler):
   272 class RepositoryStopHandler(CommandHandler):
   271     cmdname = 'stop'
   273     cmdname = 'stop'