mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2025-01-19 01:35:28 +01:00
Add terminal catches for server stop command and restart command in crafty's terminal
This commit is contained in:
parent
b368246614
commit
2d169e8f97
@ -386,14 +386,6 @@ class Server:
|
||||
if not self.check_running() and command.lower() != 'start':
|
||||
logger.warning("Server not running, unable to send command \"{}\"".format(command))
|
||||
return False
|
||||
elif command.lower() == self.settings['stop_command']:
|
||||
logger.info("Stop command detected as terminal input - intercepting. Starting Crafty's stop process for server with id: {}.".format(self.server_id))
|
||||
self.stop_threaded_server()
|
||||
return
|
||||
elif command.lower() == 'restart':
|
||||
logger.info("Restart command detected as terminal input - intercepting. Starting Crafty's restart process for server with id: {}".format(self.server_id))
|
||||
self.restart_threaded_server()
|
||||
return
|
||||
console.info("COMMAND TIME: {}".format(command))
|
||||
logger.debug("Sending command {} to server".format(command))
|
||||
|
||||
|
@ -199,6 +199,14 @@ class AjaxHandler(BaseHandler):
|
||||
|
||||
srv_obj = self.controller.get_server_obj(server_id)
|
||||
|
||||
if command == srv_obj.settings['stop_command']:
|
||||
logger.info("Stop command detected as terminal input - intercepting. Starting Crafty's stop process for server with id: {}.".format(server_id))
|
||||
self.controller.management.send_command(exec_user['user_id'], server_id, self.get_remote_ip(), 'stop_server')
|
||||
command = None
|
||||
elif command == 'restart':
|
||||
logger.info("Restart command detected as terminal input - intercepting. Starting Crafty's stop process for server with id: {}.".format(server_id))
|
||||
self.controller.management.send_command(exec_user['user_id'], server_id, self.get_remote_ip(), 'restart_server')
|
||||
command = None
|
||||
if command:
|
||||
if srv_obj.check_running():
|
||||
srv_obj.send_command(command)
|
||||
|
Loading…
x
Reference in New Issue
Block a user