def quit(self, justHide=False): """ Finishes the program execution """ if justHide: self.root.withdraw() else: try: scheds = self.scheduler_processes.keys() for t in scheds: self.try_stop_scheduler(t) except: pass try: newcron.stopcron() except: pass try: self.server.stop() except: pass try: self.tb.Destroy() except: pass self.root.destroy() sys.exit(0)
def quit(self, justHide=False): """ Finishes the program execution """ if justHide: self.root.withdraw() else: try: with self.scheduler_processes_lock: scheds = list(self.scheduler_processes.keys()) for t in scheds: self.try_stop_scheduler(t, skip_update=True) except: pass if self.options.with_cron and not self.options.soft_cron: # shutting down hardcron try: newcron.stopcron() except: pass try: # HttpServer.stop takes care of stopping softcron self.server.stop() except: pass try: self.tb.Destroy() except: pass self.root.destroy() sys.exit(0)
def stop(self, stoplogging=False): """ stop cron and the web server """ newcron.stopcron() self.server.stop(stoplogging) try: os.unlink(self.pid_filename) except: pass
def stop(self, stoplogging=False): """ stop cron and the web server """ if global_settings.web2py_crontype == 'soft': try: newcron.stopcron() except: pass self.server.stop(stoplogging) try: os.unlink(self.pid_filename) except: pass
def test_3_SimplePool(self): base = os.path.join(appdir, 'cron') write_file(os.path.join(base, 'test.py'), TEST_SCRIPT2) w2p_path = os.path.join(os.getcwd(), 'web2py.py') self.assertTrue(os.path.exists(w2p_path)) launcher = SimplePool(1) cmd1 = [sys.executable, w2p_path, '--cron_job', '--no_banner', '--no_gui', '--plain', '-S', test_app_name, '-R', "applications/%s/cron/test.py" % test_app_name] self.assertTrue(launcher(cmd1)) self.assertFalse(launcher(None)) time.sleep(1) stopcron() time.sleep(1) reset()