def testA(self): """ __testSubscribe__ Test daemon creation """ # keep the parent alive self.pid = createDaemon(self.tempDir, True) try: try: if self.pid != 0 : time.sleep(2) details = Details(os.path.join(self.tempDir,"Daemon.xml")) time.sleep(10) details.killWithPrejudice() else: while True: time.sleep(1) except: pass finally: if self.pid == 0: os._exit(-1) else: os.system('kill -9 %s' % self.pid)
def testA(self): """ __testSubscribe__ Test daemon creation """ # keep the parent alive self.pid = createDaemon(self.tempDir, True) try: try: if self.pid != 0: time.sleep(2) details = Details(os.path.join(self.tempDir, "Daemon.xml")) time.sleep(10) details.killWithPrejudice() else: while True: time.sleep(1) except: pass finally: if self.pid == 0: os._exit(-1) else: os.system('kill -9 %s' % self.pid)
def testC(self): raise nose.SkipTest config = self.testInit.getConfiguration() self.tempDir = self.testInit.generateWorkDir(config) config.component_("TestComponent") config.TestComponent.logLevel = 'INFO' config.section_("General") # try starting a component as a daemon: config.TestComponent.componentDir = os.path.join( \ self.tempDir, "Components/TestComponent1") os.makedirs(config.TestComponent.componentDir) testComponent = TestComponent(config) # we set the parent to true as we are testing testComponent.startDaemon(keepParent=True) print('trying to kill the component') time.sleep(2) daemonFile = os.path.join(config.TestComponent.componentDir, "Daemon.xml") details = Details(daemonFile) print('Is component alive: ' + str(details.isAlive())) time.sleep(2) details.killWithPrejudice() print('Daemon killed')
def testC(self): raise nose.SkipTest config = self.testInit.getConfiguration() self.tempDir = self.testInit.generateWorkDir(config) config.component_("TestComponent") config.TestComponent.logLevel = 'INFO' config.section_("General") # try starting a component as a daemon: config.TestComponent.componentDir = os.path.join( \ self.tempDir, "Components/TestComponent1") os.makedirs( config.TestComponent.componentDir ) testComponent = TestComponent(config) # we set the parent to true as we are testing testComponent.startDaemon(keepParent = True) print('trying to kill the component') time.sleep(2) daemonFile = os.path.join(config.TestComponent.componentDir, "Daemon.xml") details = Details(daemonFile) print('Is component alive: '+str(details.isAlive())) time.sleep(2) details.killWithPrejudice() print('Daemon killed')
if not opts.inifile: sys.exit('No configuration specified') cfg = loadConfigurationFile(opts.inifile) component = cfg.Webtools.application workdir = getattr(cfg.Webtools, 'componentDir', '/tmp/webtools') if workdir is None: workdir = '/tmp/webtools' root = Root(cfg) if opts.status: daemon = Details('%s/Daemon.xml' % workdir) if not daemon.isAlive(): print("Component:%s Not Running" % component) else: print("Component:%s Running:%s" % (component, daemon['ProcessID'])) elif opts.kill: daemon = Details('%s/Daemon.xml' % workdir) daemon.kill() daemon.removeAndBackupDaemonFile() elif opts.terminate: daemon = Details('%s/Daemon.xml' % workdir) daemon.killWithPrejudice() daemon.removeAndBackupDaemonFile() elif opts.daemon: createDaemon(workdir) root.start(False) else: root.start()