diff --git a/app/classes/shared/cmd.py b/app/classes/shared/cmd.py index dfce718a..d9cd6832 100644 --- a/app/classes/shared/cmd.py +++ b/app/classes/shared/cmd.py @@ -34,17 +34,6 @@ class MainPrompt(cmd.Cmd, object): def emptyline(): pass - @staticmethod - def _clean_shutdown(): - exit_file = os.path.join(helper.root_dir, "exit.txt") - try: - with open(exit_file, 'w') as f: - f.write("exit") - - except Exception as e: - logger.critical("Unable to write exit file due to error: {}".format(e)) - console.critical("Unable to write exit file due to error: {}".format(e)) - def do_exit(self, line): self.universal_exit() @@ -77,7 +66,6 @@ class MainPrompt(cmd.Cmd, object): logger.info("Stopping all server daemons / threads") console.info("Stopping all server daemons / threads - This may take a few seconds") websocket_helper.disconnect_all() - self._clean_shutdown() console.info('Waiting for main thread to stop') while True: if self.tasks_manager.get_main_thread_run_status(): diff --git a/app/classes/shared/helpers.py b/app/classes/shared/helpers.py index 36958b9d..ede4beb0 100644 --- a/app/classes/shared/helpers.py +++ b/app/classes/shared/helpers.py @@ -230,16 +230,6 @@ class Helpers: version_data.get('meta', '?')) return str(version) - def do_exit(self): - exit_file = os.path.join(self.root_dir, 'exit.txt') - try: - open(exit_file, 'a').close() - - except Exception as e: - logger.critical("Unable to create exit file!") - console.critical("Unable to create exit file!") - sys.exit(1) - def encode_pass(self, password): return self.passhasher.hash(password) diff --git a/app/classes/shared/server.py b/app/classes/shared/server.py index 623f22d1..4584b348 100644 --- a/app/classes/shared/server.py +++ b/app/classes/shared/server.py @@ -171,12 +171,10 @@ class Server: if not helper.check_path_exists(self.server_path): logger.critical("Server path: {} does not seem to exits".format(self.server_path)) console.critical("Server path: {} does not seem to exits".format(self.server_path)) - helper.do_exit() if not helper.check_writeable(self.server_path): logger.critical("Unable to write/access {}".format(self.server_path)) console.warning("Unable to write/access {}".format(self.server_path)) - helper.do_exit() def start_server(self, user_id): if not user_id: diff --git a/app/classes/shared/tasks.py b/app/classes/shared/tasks.py index 1ab6c05e..47e390b9 100644 --- a/app/classes/shared/tasks.py +++ b/app/classes/shared/tasks.py @@ -48,7 +48,6 @@ class TasksManager: self.webserver_thread = threading.Thread(target=self.tornado.run_tornado, daemon=True, name='tornado_thread') - self.main_kill_switch_thread = threading.Thread(target=self.main_kill_switch, daemon=True, name="main_loop") self.main_thread_exiting = False self.schedule_thread = threading.Thread(target=self.scheduler_thread, daemon=True, name="scheduler") @@ -65,16 +64,6 @@ class TasksManager: def get_main_thread_run_status(self): return self.main_thread_exiting - def start_main_kill_switch_watcher(self): - self.main_kill_switch_thread.start() - - def main_kill_switch(self): - while True: - if os.path.exists(os.path.join(helper.root_dir, 'exit.txt')): - logger.info("Found Exit File, stopping everything") - self._main_graceful_exit() - time.sleep(5) - def reload_schedule_from_db(self): jobs = management_helper.get_schedules_enabled() schedule.clear(tag='backup') @@ -122,7 +111,6 @@ class TasksManager: def _main_graceful_exit(self): try: os.remove(helper.session_file) - os.remove(os.path.join(helper.root_dir, 'exit.txt')) os.remove(os.path.join(helper.root_dir, '.header')) self.controller.stop_all_servers() except: diff --git a/main.py b/main.py index 7d812ab4..86e7fd81 100644 --- a/main.py +++ b/main.py @@ -137,9 +137,6 @@ if __name__ == '__main__': # refresh our cache and schedule for every 12 hoursour cache refresh for serverjars.com tasks_manager.serverjar_cache_refresher() - # this should always be last - tasks_manager.start_main_kill_switch_watcher() - logger.info("Checking Internet/Port Service. This may take a minute.") console.info("Checking Internet/Port Service. This may take a minute.") diff --git a/requirements.txt b/requirements.txt index 2f479f49..b395419e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,6 +2,7 @@ cryptography~=3.4 argon2-cffi~=20.1 bleach~=3.1 colorama~=0.4 +cryptography~=3.4 peewee~=3.13 pexpect~=4.8 psutil~=5.7