Native Linux server (with management scripts)

You could set a cron job that runs periodically to start them back up again.

I think the crontab text would be like...

Code:
5  *  *  *  * sdtd  7dtd.sh start "!"
That should have cron start all instances every 5 minutes. If they are already up, nothing happens.

You could set up a task to see if they are up, and do nothing if they are. Then run the startup command if they are not. Then set that task to be run by cron. That's beyond my current ability though.

 
You could set a cron job that runs periodically to start them back up again.
I think the crontab text would be like...

Code:
5  *  *  *  * sdtd  7dtd.sh start "!"
That should have cron start all instances every 5 minutes. If they are already up, nothing happens.

You could set up a task to see if they are up, and do nothing if they are. Then run the startup command if they are not. Then set that task to be run by cron. That's beyond my current ability though.
i should be able to use root's crontab -e and paste that in there and should work right? having alittle issue with crontab not starting it

 
i should be able to use root's crontab -e and paste that in there and should work right? having alittle issue with crontab not starting it
If you do "sudo su" to switch into the root, doing "crontab -e" should show you the root crontab schedule.

If you are having problems with scripts not running in the schedule, it might be due to the reduced environment (not having a search path to find programs when the full path is not explicit). Try adding the following in root's crontab schedule:

Code:
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
#
# Crontab SYNTAX:
# minute(0-59) hour(0-23) day-of-month(1-31) month(1-12) day-of-week(0-6) command-to-execute
#
5  *  *  *  * /usr/local/bin/7dtd.sh start "!"
NOTE: You didn't include a full path to where 7dtd.sh was located which means the root crontab simply could not execute it because the default schedule does not have a search path environment variable defined. You could specify the full path like I did but if there are any programs in the script that do not explicitly specify the full path, they would also fail. Having the environment path variable defined helps prevent failure like this but also increases the security risk for hijacked commands but it is a low risk.

Reference Post

LHammonds

 
Last edited by a moderator:
Alloc, if I want to "nice" the server so it runs at higher priority, what would be the best way to do that using your scripts?

UPDATE: I ended up slapping this together and having cron run it every 15 minutes...seems to work, but my bash scripting is pretty bad. :smile-new:

Code:
#!/bin/bash

############################################################################
# 7DTD Renice Script by The Hated Crew                                     #
# Call with cron on an interval you choose.                                #
# Script must be run as root user.                                         #
############################################################################

SDTDPIDFILE=/opt/sdtd/instances/THC/7dtd.pid
SDTDNICEVALUE=-15

#Check to see if the PID file exists, if so, read PID into $sdtdpid variable.
if [ -f $SDTDPIDFILE ]; then
       sdtdpid=$(cat $SDTDPIDFILE)
#Check to make sure the PID is actually running, if so, capture nice value of PID.
       if [ -e /proc/$sdtdpid ]; then
               sdtdniceval=$(ps --no-heading -p $sdtdpid -o "ni")
#If nice value isn't set then run the renice command.
               if [ $sdtdniceval -ne $SDTDNICEVALUE ]; then
                       renice -n $SDTDNICEVALUE -p $sdtdpid
               fi
       else
               echo "7DTD server PID file exists but server isn't running."
       fi
else
       echo "7DTD PID file doesn't exist, so server is probably not running."
fi
 
Last edited by a moderator:
How many are using Linux to host? Are we able to run 64 bit? I did not read the entire 69 pages so sorry for asking. What is the preferred os? Centos, Ubuntu, others? Thinking of going dedicated as I am tired of shared hosting providers... Thoughts?

 
Roughly 15% of the servers that are listed are hosted from Linux. Of course 64 bit is supported. Officially supported: Debian based systems.

 
Roughly 15% of the servers that are listed are hosted from Linux. Of course 64 bit is supported. Officially supported: Debian based systems.
Thank you Alloc. I assumed quite a few were hosted that way, just haven’t attempted to run one in Linux. Guess I better “bone up” on some Linux command line stuff.

 
Thanks Alloc

Just wanted to say thanks for your scripts and information i got my Linux server up and running in no time... And anyone that's wondering for me my Linux server is running better then my windows server did. I do have one question can you recommend a Server manger program kinda like rat or server manager for linux?

 
Would you consider updating the scripts to allow different instances to use different engine code? I ask because I run modded servers, and if I want to run two servers running two different mods I don't see a way to do that with the scripts currently as all instances use the same files from the engine directory. Thanks.

 
No, that's not planned as the goal is to have the dedi itself support different mod selections for different instances.

 
Well, if the game supports to select the mods that should be enabled on a per instance base (probably from serverconfig) there's no need to have different engine folders. You'd just have one and specify which mods to load on each instance.

 
Not sure this is the best place to post this question but I have posted as recent as a couple of months ago in this thread.

My questions are regarding Linux dedicated servers. Specifically, I installed a test server using https://linuxgsm.com/lgsm/sdtdserver/ and as far as the server goes its running very well. Now, the issues I have is that on Windows installations there is usually a folder named Saves and obviously this is where saves are located and I have found that is typically where the server admin.xml is located. I have tried to get admin to function by locating the .xml in various locations and also saves still seem to write elsewhere.

I confess I am a bit rusty with Linux especially since its been awhile. I had no issue with running a Linux version on my home computer and everything worked. I am at a loss and hope someone wiser could share some enlightenment. I am brushing up on 16.4 again off and on until the next update.

After I post, its always after I post... I finally located where this stores the saves and admin file. A mod could delete this as It has been resolved. I think.

 
Last edited by a moderator:
Hello everyone, i just installed the server on my Linux VPS. I start the server, join the game and i get an error "Could not retrieve server information." And then the server closes. Debian 8 and Cent os 7 (thats what i currently have). Could someone help me please? Thanks in advance.

 
Trying to set up an alpha 17 dedicated server. I saw the change log says the scripts were updated for it on the 16th. However, the updatescripts command is not pulling down anything new. It appears to be downloading version 110 from last August.

Am I doing something wrong?

 
Trying to set up an alpha 17 dedicated server. I saw the change log says the scripts were updated for it on the 16th. However, the updatescripts command is not pulling down anything new. It appears to be downloading version 110 from last August.
Am I doing something wrong?
You need to add "++experimental" after updateengine if you're running allocs cmds.

Although, it appears the linux dedi is broken. I can't connect to it anymore. Just get server is still initializing msg. Logs look as if the server started fine and is kicking me. also, outside ip peeps can't even reach the server now. Did ports change?

 
Last edited by a moderator:
I grabbed the updated engine and server fixes, made a new instance, started i tup, and the log shows it crashing immediately in mono for an unhandled NULL exception. Probably need to wait a bit for both the 7d2d A17 itself and maybe Alloc's fixes to stabilize a bit before a dedicated linux server will be an option :(

 
I grabbed the updated engine and server fixes, made a new instance, started i tup, and the log shows it crashing immediately in mono for an unhandled NULL exception. Probably need to wait a bit for both the 7d2d A17 itself and maybe Alloc's fixes to stabilize a bit before a dedicated linux server will be an option :(
mine didnt crash immediately it got to the end then this:

2018-11-19T18:38:38 13.476 INF Started thread ChunkCalc

2018-11-19T18:38:38 13.476 INF Started thread ChunkRegeneration

2018-11-19T18:38:38 13.581 INF World.Load: Random Gen

2018-11-19T18:38:38 13.583 INF Loading base world file header...

NullReferenceException: Object reference not set to an instance of an object

at World.LoadWorld (System.String _sWorldName, Boolean _fixedSizeCC) [0x00000] in <filename unknown>:0

at GameManager+<createWorld>c__Iterator7.MoveNext () [0x00000] in <filename unknown>:0

at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

Mine shows as running just stuck at initializing.

 
Trying to set up an alpha 17 dedicated server. I saw the change log says the scripts were updated for it on the 16th. However, the updatescripts command is not pulling down anything new. It appears to be downloading version 110 from last August.
Am I doing something wrong?
Scripts weren't updated yet. You were probably looking at the server mod.

Scripts will work for the most part, but the serverconfig editor isn't updated to work with the new settings yet.

You need to add "++experimental" after updateengine if you're running allocs cmds.
--, not ++

I grabbed the updated engine and server fixes, made a new instance, started i tup, and the log shows it crashing immediately in mono for an unhandled NULL exception. Probably need to wait a bit for both the 7d2d A17 itself and maybe Alloc's fixes to stabilize a bit before a dedicated linux server will be an option :(
Log? Sounds like a generic issue though so might better go to the bug report thread.

mine didnt crash immediately it got to the end then this:
2018-11-19T18:38:38 13.476 INF Started thread ChunkCalc

2018-11-19T18:38:38 13.476 INF Started thread ChunkRegeneration

2018-11-19T18:38:38 13.581 INF World.Load: Random Gen

2018-11-19T18:38:38 13.583 INF Loading base world file header...

NullReferenceException: Object reference not set to an instance of an object

at World.LoadWorld (System.String _sWorldName, Boolean _fixedSizeCC) [0x00000] in <filename unknown>:0

at GameManager+<createWorld>c__Iterator7.MoveNext () [0x00000] in <filename unknown>:0

at UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) [0x00000] in <filename unknown>:0

Mine shows as running just stuck at initializing.
Wrong world, there's no "Random Gen".

 
Back
Top