def subcommand_start(args): ''' Start subcommand ''' try: options, arguments = getopt.getopt(args[1:], 'k') except getopt.error: sys.exit('usage: neubot start [-k]') if arguments: sys.exit('usage: neubot start [-k]') kill = False for tpl in options: if tpl[0] == '-k': kill = True # # Wait for the parent to die, so that it closes the listening # socket and we can successfully bind() it. # count = 0 while kill: running = utils_ctl.is_running('127.0.0.1', '9774', quick=1) if not running: break utils_ctl.stop('127.0.0.1', '9774') count += 1 if count > 512: sys.exit('FATAL: cannot stop neubot daemon') # Lazy import from neubot import background_win32 background_win32.main(['neubot'])
def subcommand_stop(args): ''' Stop subcommand ''' try: options, arguments = getopt.getopt(args[1:], '') except getopt.error: sys.exit('usage: neubot stop') if options or arguments: sys.exit('usage: neubot stop') running = utils_ctl.is_running('127.0.0.1', '9774') if not running: sys.exit('ERROR: neubot is not running') utils_ctl.stop('127.0.0.1', '9774')
def subcommand_start(args): ''' Start subcommand ''' try: options, arguments = getopt.getopt(args[1:], 'k') except getopt.error: sys.exit('usage: neubot start [-k]') if arguments: sys.exit('usage: neubot start [-k]') kill = False for tpl in options: if tpl[0] == '-k': kill = True if kill: running = utils_ctl.is_running('127.0.0.1', '9774') if running: utils_ctl.stop('127.0.0.1', '9774') # Lazy import from neubot import background_win32 background_win32.main(['neubot'])