If the server spawns a script and the script is running when all players leave the game then the server loses its connection on the port specified by SERVER_PORT and starts trying port numbers and will make a connetion but on a different port number
I added code to the script to detect GAME_END from lagger log and issue an EXIT command to console so that the server will restart but it still cannot connect on the original SERVER_PORT , but after checking the console log I see that GAME_END is executed after the server attempts the connection so that doesnt really help
I even tried KILL $PPID from the script to kill the parent process (the server) and has the same effect as EXIT
As a test I made a basic server and spawned an infinite loop script that does nothing just to see if the echo to console for commands was the problem in my main game script but even this script that does nothing causes the same issue
Without any scripts running the server always will connect to SERVER_PORT after all players leave
This is the donothing.sh script I used to test the issue, I even tried it without the sleep just in case but it made no difference
Code: Select all
#!/bin/bash
while true;
do
sleep 1
done
Any ideas ? Thanks
BTW the other 5 servers that are running on the same raspberry pi but dont currently use scripts are working fine and never have a problem connecting to SERVER_PORT after all the players leave the game
Thanks
--------------------------
Update: if I connect to the server console screen with screen -r server6 and then press CTRL-C to shut down screen and the server, then start them back up I find that the server will connect to the correct SERVER_PORT