So, I am experiencing a problem where occasionally my restart scripts aren't working correctly on one server. The normal process is this: Every morning (as scheduled in crontab), a script (start.sh) runs that will run a bunch of other scripts. These other scripts will connect to my running screens, kill the screen, and then start another server up with the correct properties.
However, I noticed today, for some reason
sometimes instead of killing the screen, it will just make a whole new game server, and I'll have a bunch of servers running in a bunch of different screens with serial hostports.
I'm hoping a fresh set of eyes can help me identify the problem. I'm going to post each step in the process starting with crontab:
/etc/crontab
Code:
20 11 * * * gouser /home/gouser/start.sh
~/start.sh (only relevant pieces included)
Code:
#!/bin/bash
/home/gouser/go/surf/surf.sh
sleep 10
~/go/surf/surf.sh (only the relevant part)
Code:
#!/bin/bash
screen -X -S surf quit
sleep 4
cd /home/gouser/go/surf
taskset -c 6 /usr/bin/screen -dmS surf ./srcds_run -game csgo [etc]
My dedicated server box also reboots once per month.
Today, I noticed that my servers hadn't updated automatically this morning when the script should have run at 11:20 server time (which is like 5:20 my time) so I ran the script manually and noticed there were three screens running a surf server, and I had three surf servers running. (All of these screens were called "surf", so the script didn't know which one to connect to and kill.) They were being assigned new hostports as the current one was taken, and they were just there running unbeknownst to me.
Since the server machine last rebooted on the 1st of the month, and there's only 3 surf servers running (as opposed to 16) I can only assume this happening willy-nilly. I would like to help maybe figuring out why sometimes the script doesn't kill the screen and instead starts a new one up.
__________________