Raised This Month: $ Target: $400
 0% 

[Linux] Automated restart scripts sometimes messing up


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ghostofmybrain
Veteran Member
Join Date: Mar 2010
Old 08-16-2018 , 16:54   [Linux] Automated restart scripts sometimes messing up
Reply With Quote #1

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.
__________________
Boycott ESEA
My servers
ghostofmybrain is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:53.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode