mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-12 11:13:16 +00:00
The server_controller script now automatically restarts a crashed server.
This commit is contained in:
@@ -37,7 +37,15 @@ def handle_message(data, addr):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
sock.settimeout(60*6) # 10 minute timeout
|
||||
while True:
|
||||
try:
|
||||
data, addr = sock.recvfrom( 1024 ) # buffer size is 1024 bytes
|
||||
handle_message(data,addr)
|
||||
except socket.timeout:
|
||||
# try to start the server again
|
||||
print("Server timed out.. attempting restart.")
|
||||
if last_ticker_state:
|
||||
open("crashmsg.txt","a+").write("Server crashed, trying to reboot. last ticker state: "+last_ticker_state+"\n")
|
||||
subprocess.call("killall -9 DreamDaemon")
|
||||
subprocess.call("./start")
|
||||
Reference in New Issue
Block a user