Native Linux server (with management scripts)

Only its not.... seems to have somewhat crashed yet still be running... this is making an auto restart cron with " 7dtd.sh start Zone" not that reliable to use..
Well, that's why I wrote that back when you asked:

Well, if it's about real crashes (i.e. process died) <...> . Obviously doesn't work if the process is still running but the server isn't doing what it should.
;)

I.e. you probably just got that case: Server process still running but not doing its job anymore. Currently no way to autodetect this.

 
Well, that's why I wrote that back when you asked:
;)

I.e. you probably just got that case: Server process still running but not doing its job anymore. Currently no way to autodetect this.
what is this "/usr/local/lib/7dtd/common.sh: line 186: 25921 Killed nc 127.0. 0.1 $TEL_PORT 0<&3" bit then.. because that showing up seems to be a good indication its crashed for me.

 
what is this "/usr/local/lib/7dtd/common.sh: line 186: 25921 Killed nc 127.0. 0.1 $TEL_PORT 0<&3" bit then.. because that showing up seems to be a good indication its crashed for me.
That's happening whenever the remote end doesn't reply to netcat (used for the network "Telnet" client in the scripts). Wouldn't call this a safe indicator ;)

got all this errors after starting server and the hooks aren't working http://pastebin.com/MZdrkqM4
Though sorted out might be interesting for others with the same problem:

Looks like the game uses a lot of file descriptors sometimes and by default a single process in most Linux distros may only open like 1000 files at once. Solution in qriff's post here

 
As a paranoid Linux Server Admin, I refuse to run strange scripts as root, especially if they download other strange scripts which are also run as root. Instead, I painstakingly ran through all your scripts' actions manually and distilled them down to a short 18 lines that can be run without root access (assuming all prerequisites are installed) and from any installation directory.

Would it be alright if I posted the process here for other people who may be as paranoid as I am?

 
This does not set up the start script, stop script, or the startstop daemon included in Alloc's official instructions, but it is simple to stop the server with the "shutdown" command from telnet or in game.

First step is to ensure you have all the pre-requisites installed and if you're so inclined, have user set up to run the server. These pieces will require root.

After navigating to the directory you want the server installed to, here are the steps to get everything up and running:

Save the current directory to a variable for referencing later

Code:
installdir=$(pwd)
Download and extract all the tarballs

Code:
wget http://illy.bz/fi/7dtd/linux_files.tar.gz -O - | tar -xzf -
mkdir management_scripts && wget http://illy.bz/fi/7dtd/management_scripts.tar.gz -O - | tar -xzf - -C management_scripts
mkdir steamcmd && wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz -O - | tar -xzf - -C steamcmd
Install the dedicated server (put your steam username in place of "loginnamegoeshere")

Steam will ask for your password and, if applicable, your steamguard code.

Code:
./steamcmd.sh +quit
./steamcmd.sh +@sSteamCmdForcePlatformType windows +login loginnamegoeshere +force_install_dir $installdir/engine "+app_update 294420" validate +quit
Copy the fixes to their correct locations

Code:
cd ..
cp -R linux_files/engine/* engine/
cp engine/7DaysToDie_Data/Managed/Assembly-CSharp.dll engine/7DaysToDie_Data/Managed/Assembly-CSharp.dll_orig
cp management_scripts/usr/local/lib/7dtd/server-fixes/* engine/7DaysToDie_Data/Managed/
cp engine/Install/32bit/SteamworksManaged.dll engine/7DaysToDie_Data/Managed/
cp management_scripts/home/sdtd/templates/admins.xml engine/serveradmin.xml
Edit the admin and config files, if you want

Code:
cd engine
vi serveradmin.xml
vi serverconfig.xml
create a directory to put the logs in

Code:
mkdir logs
start the server

Code:
LD_LIBRARY_PATH=$installdir/linux_files LC_ALL=C $installdir/engine/7DaysToDie.x86 -- -logfile $installdir/engine/logs/output_log.txt -configfile=$installdir/engine/serverconfig.xml -dedicated
P.S. You might want to install tmux, dtach, or screen so you don't tie up your terminal. It's easiest to use one of those to run bash, and then run the command to start the server.

- - - Updated - - -

Here's the same instructions, just in one long code block instead of broken up with explanations:

Code:
installdir=$(pwd)
wget http://illy.bz/fi/7dtd/management_scripts.tar.gz -O - | tar -xf -
wget http://illy.bz/fi/7dtd/linux_files.tar.gz -O - | tar -xf -
mkdir steamcmd
cd steamcmd/
wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz -O - | tar -xf -
./steamcmd.sh +quit
./steamcmd.sh +@sSteamCmdForcePlatformType windows +login loginnamegoeshere +force_install_dir $installdir/engine "+app_update 294420" validate +quit
cd ..
cp -R linux_files/engine/* engine/
cp engine/7DaysToDie_Data/Managed/Assembly-CSharp.dll engine/7DaysToDie_Data/Managed/Assembly-CSharp.dll_orig
cp management_scripts/usr/local/lib/7dtd/server-fixes/* engine/7DaysToDie_Data/Managed/
cp engine/Install/32bit/SteamworksManaged.dll engine/7DaysToDie_Data/Managed/
cp management_scripts/home/sdtd/templates/admins.xml engine/serveradmin.xml
cd engine/
vi serveradmin.xml
vi serverconfig.xml
mkdir logs
LD_LIBRARY_PATH=$installdir/linux_files LC_ALL=C $installdir/engine/7DaysToDie.x86 -- -logfile $installdir/engine/logs/output_log.txt -configfile=$installdir/engine/serverconfig.xml -dedicated
 
Last edited by a moderator:
Running on Ubuntu 14 x64.

Server runs smooth and everything works. But a few times a day the server stops and I have to start it again. A few times it stopped within 60 seconds of starting it, but most the time it just randomly stops about 2-3 times per day.

Who knows, it could be my map which I don't really plan on resetting anytime too soon, but my real question is.. is there a way for the server to have some sort of crash detection like FrontRunner has? Even if a script were written utilizing 7dtd.sh status (instance) or even to write one to send the start command every 60 seconds, which would be ignored if it were already running. Suggestions? And FYI, I'm running FrontRunner on my windows 7 pc which connects to the linux server, but of course its crash detection feature can only be used if i were running the server locally on the same host machine.

 
Running on Ubuntu 14 x64.Server runs smooth and everything works. But a few times a day the server stops and I have to start it again. A few times it stopped within 60 seconds of starting it, but most the time it just randomly stops about 2-3 times per day.
Last part of this post, and then these: one, two ;)

Not sure what exactly FRT was doing but I think he also just checks whether the process still exists. So in that case you will get the same level of detection the way described in those posts.

Shouldn't crash that frequently though. Do you run an older save from pre 9.3 era?

 
Last part of this post, and then these: one, two ;)
Not sure what exactly FRT was doing but I think he also just checks whether the process still exists. So in that case you will get the same level of detection the way described in those posts.

Shouldn't crash that frequently though. Do you run an older save from pre 9.3 era?


I'm actually running this map.

http://www.7days2die.ru/threads/uluchshennaja-karta-navezgane-c-71-obektom.447/

I'm going to start looking into your references and then amend my comment. TY.

 
Crontab, just what the doctor ordered. I just has to edit visudo to remove my password requirement when running commands and works great. Now as far as the crashes themself, well I'll probably just find a more updated map and start there.

Thanks for the nice setup Alloc!

Clinton

 
is there any .sh cron script that could check an instance and start it up if its not running? (ie its crashed seems to have started happening since EAC)
not that familiar with .sh stuff only php
Kind of late since you asked this a month ago.

But I made a perl daemon that checks and restarts the server if it crashes, and also emails you if it does. Some familiarity with perl is assumed to use it.

http://pastebin.com/dkxKrgjV

 
I checked it out, but seems to have the same problem I had with not being able to automate a restart for when 7dtd has one of those.. crashes where players know server is down because they can't get on it, but automated checks like 7dtd.sh start <name> fail to work at restarting because the 7dtd process has semi crashed but is still seen as running. I notice getting a telnet response fails when it is down but still running.. but never really bothered doing much testing when the server had 'sort of' crashed to really make any progress on a something that could be used to automate a restart in such an event.. just easier to restart it manually and forget it happens until the next time.

Anyway I went with automated 12hr restarts, 5min then 5second notice to players that it would be restarted, with an attempt at a clean shutdown giving it 8seconds to do its business and then a nice kill every 7dtd process afterwards just incase shutdown fails which it seems to when 7dtd crashes .. and then start again :) its worked ok far, apart from the first time it shutdown the server and failed to start again.. got complaints on that one lol.

 
So has anyone noticed that when they restore a backup it causes the server to start to crash on player exit?

I've looked through the guide page and don't see anything about this. The method I took of restoring a backup was to simply cp -a the backup folder into the instances after removing the original. Is this the wrong way to go about it? Are there any steps I'm missing that would cause this?

 
So has anyone noticed that when they restore a backup it causes the server to start to crash on player exit?
I've looked through the guide page and don't see anything about this. The method I took of restoring a backup was to simply cp -a the backup folder into the instances after removing the original. Is this the wrong way to go about it? Are there any steps I'm missing that would cause this?
Haven't heard of such a problem before. Also don't see any reason why this should happen, the backup folders are just plain copies of the instance folder.

Anything in the log after such crashes?

 
Haven't heard of such a problem before. Also don't see any reason why this should happen, the backup folders are just plain copies of the instance folder.
Anything in the log after such crashes?
What log should I be looking in again? output.log or stdout.log?

 
Okay I think I found what you wanted to see. Here's what the output log shows right at the time one of these crashes happened.

2014.10.21 18:24:22: Freeing user FeistyLemur

2014.10.21 18:24:23: Fallback handler could not load library /home/sdtd/engine/7DaysToDie_Data/Mono/x86/SteamworksNative

2014.10.21 18:24:23: Player FeistyLemur disconnected after 35.5 minutes

2014.10.21 18:24:23: Player set to offline: <Blanked out my steam ID here>

2014.10.21 18:24:23: Removing player with id clientId=1, entityId=171

2014.10.21 18:24:23: GMSG: FeistyLemur left the game

2014.10.21 18:24:23: Removing observed entity 1

2014.10.21 18:24:23: Exited thread_CommWriter: cl=1, ch=1

2014.10.21 18:24:23: Exited thread_CommWriter: cl=1, ch=2

2014.10.21 18:24:23: No objects for the given player ID were deleted 1

2014.10.21 18:24:23: Exited thread_CommReader: cl=1, ch=1

2014.10.21 18:24:23: Couldn't send RPC function 'RPC_SetWorldTime'

2014.10.21 18:24:23: Exited thread_CommReader: cl=1, ch=2

2014.10.21 18:24:23: OnPlayerDisconnected 1

2014.10.21 18:24:23: Disconnected player not found in client list...

2014.10.21 18:24:23: No objects for the given player ID were deleted 1

 
That part looks just fine. Nothing after it?
No that's the very last entries in that output log line for line. I was online with 2 other players on. I noticed this before as well when playing around with backups and wrote it off to the 9.2 to 9.3 upgrade having broken the map and made a new instance. The new instance worked fine up until I restored a backup on Sunday and noticed this happening again.

Literally what I did was rm -r the original folder from instances/servername and cp -a the backup to intances/servername then start it up.

It doesn't happen every single time.

 
Back
Top