[Linux] Automated restart scripts sometimes messing up
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 Code:
#!/bin/bash Code:
#!/bin/bash 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. |
Re: [Linux] Automated restart scripts sometimes messing up
Perhaps you accidentally sent an Xoff signal, which terminates all input (which I believe blocks quit commands). In doing so, you won't quit the server and will make another server. Add a check for processes with the same name and kill it as a backup.
If it happens again, you could attach the session and see if any input is being allowed. Curious, why not use something like LGSM? |
Re: [Linux] Automated restart scripts sometimes messing up
Quote:
Quote:
|
Re: [Linux] Automated restart scripts sometimes messing up
Quote:
Beyond killing the service itself, you could add a simple grep look for all names matching and quit/kill those servers in case this ever happens again. As for the root problem of how it happened, unless it happens again I haven't the faintest idea. Perhaps someone else has had this happen as I don't use screen much anymore. |
Re: [Linux] Automated restart scripts sometimes messing up
Quote:
It's weird because if I try to just run the startup script when the extra screens are running, it will say "there are multiple screens with that name", so I am not even sure how it's getting to the next line and even launching the server? |
Re: [Linux] Automated restart scripts sometimes messing up
If you can and do have full console logs, check for what happened when you sent the command quit. That's honestly the most important factor here, you can see if there was any character or input send before which would cause it to fail, or if you have a parameter set to simply restart the server on the quit command sent.
As for a loop, there's a ton of different ways, but without your full codes I can only suggest looking at examples and adding it however it fits your current setup. Any of the following should get you what you want. Example 1 Example 2 Example 3 Example 3 |
Re: [Linux] Automated restart scripts sometimes messing up
Those are my full codes. The only thing I took out was pieces of start.sh that started other servers, and things in my startup like my authkey
I'll turn logging on and see if i can notice anything next time it happens. Thank you. |
Re: [Linux] Automated restart scripts sometimes messing up
You could try this script:
https://github.com/crazy-max/csgo-server-launcher Really simple to set up, and works 100%. |
Re: [Linux] Automated restart scripts sometimes messing up
No thanks, I'd rather figure out what is wrong with mine it's of just ignoring the problem.
|
Re: [Linux] Automated restart scripts sometimes messing up
|
All times are GMT -4. The time now is 19:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.