Jump to content

Native Linux server (with management scripts)


Alloc

Recommended Posts

Is there any way to force a 2nd install of the entire game engine using this management script so I can run servers with unique mods? Can I somehow install a 2nd copy of the script with a new name and use it to install a 2nd copy? What would be the best way to go about this?

Link to comment
Share on other sites

Is there any way to force a 2nd install of the entire game engine using this management script so I can run servers with unique mods? Can I somehow install a 2nd copy of the script with a new name and use it to install a 2nd copy? What would be the best way to go about this?

Not directly supported. You'd have to either create a second set of the scripts that point to a different script-config (as well as updating all the links between the individual script files) which would probably be the clean way; or just create a second engine folder and copy the start-script to have one start command for the original folder and one for the new folder. In that case you'd have to be careful with starting the different saves with the appropriate command though as otherwise it might break saves if they don't run with the same mods each time.

Link to comment
Share on other sites

Not directly supported. You'd have to either create a second set of the scripts that point to a different script-config (as well as updating all the links between the individual script files) which would probably be the clean way; or just create a second engine folder and copy the start-script to have one start command for the original folder and one for the new folder. In that case you'd have to be careful with starting the different saves with the appropriate command though as otherwise it might break saves if they don't run with the same mods each time.

 

Thanks! I ended up going the route of changing all the scripts and pointing them to new paths for a completely separate installation. Wasn't too difficult, just gotta make sure you get all of them. I was thinking it would be cool to have a script to modify the script like this, but then I figured it would be easier to just build the functionality into the existing script to either create a new instance of an existing engine, or install a fresh engine. Just an idea. If I could do it I would, but I'm all new to this as of about 2 weeks ago. I will attempt to learn more, but if you or anyone else with more experience then me would add this that would be awesome. Thanks for the awesome scripts to begin with, they make linux servers so much less of a headache!

Link to comment
Share on other sites

Problems trying to use automated scripts

 

I was trying to set up a dedicated server following your wiki, it shows to do

wget http://svn.illy.bz/7dtd/bootstrapper/bootstrap.sh

 

but when i do, i get an error message 401 Authorization Required, am I doing something wrong?

I then tried to do the manual way with

wget http://illy.bz/fi/7dtd/management_scripts.tar.gz

but that returns 404 not found....

 

What am i doing wrong?

Link to comment
Share on other sites

No proxy, i have tried from 2 different locations (home and work) on 2 different machines and get the same messages

FWIW I just tried this and was able to pull the file down without any trouble. Does svn.illy.bz resolve to 178.63.97.203 for you? I'd also try pulling it up on a browser to see what response you get.

 

user@saffron:/tmp$ wget http://svn.illy.bz/7dtd/bootstrapper/bootstrap.sh
--2017-02-17 09:31:40--  http://svn.illy.bz/7dtd/bootstrapper/bootstrap.sh
Resolving svn.illy.bz (svn.illy.bz)... 178.63.97.203
Connecting to svn.illy.bz (svn.illy.bz)|178.63.97.203|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7366 (7.2K) [text/plain]
Saving to: ‘bootstrap.sh’

bootstrap.sh                      100%[=============================================================>]   7.19K  --.-KB/s    in 0.1s

2017-02-17 09:31:42 (55.6 KB/s) - ‘bootstrap.sh’ saved [7366/7366]

Link to comment
Share on other sites

  • 1 month later...

Still got the Problem :(

 

Hello Guys,

 

i followed the Tutorial on Page 46 for my Linux Server.

 

But i got still this Problem :

 

root@vps:~# 7dtd.sh start MyStarvationMod

/usr/local/lib/7dtd/common.sh: line 78: /usr/local/lib/7dtd/start-stop-daemon/start-stop-daemon: No such file or directory

/usr/local/lib/7dtd/common.sh: line 78: /usr/local/lib/7dtd/start-stop-daemon/start-stop-daemon: No such file or directory

Failed!

 

i installed already libc6-dev..

 

Can anyone help me pls?

 

Thank you!

Link to comment
Share on other sites

But i got still this Problem :

 

root@vps:~# 7dtd.sh start MyStarvationMod

/usr/local/lib/7dtd/common.sh: line 78: /usr/local/lib/7dtd/start-stop-daemon/start-stop-daemon: No such file or directory

/usr/local/lib/7dtd/common.sh: line 78: /usr/local/lib/7dtd/start-stop-daemon/start-stop-daemon: No such file or directory

Failed!

 

i installed already libc6-dev..

Well, you failed to compile the daemon during installation of the scripts. Go to /usr/local/lib/7dtd/start-stop-daemon and run make. Either it succeeds in which case you're done or it fails and in that case you'll have to fix the reasons why it's failing (most likely missing dependencies for compilation).

Link to comment
Share on other sites

  • 5 weeks later...

7dtd.conf: line 1: syntax error near unexpected token `)'

 

Hello everybody.

 

I have a problem with the management scripts.

 

My environment:

V server: Ubuntu 16.04.2 LTS (GNU / Linux 4.4.0-042stab123.1 x86_64)

 

 

When I try to create an instance or try to edit an instance or do anything with the scripts, the following error appears (e.g print the config of instance "test"):

 

root@v-server:/usr/local/lib/7dtd# 7dtd.sh instances print_config test
/etc/7dtd.conf: line 1: syntax error near unexpected token `)'
/etc/7dtd.conf: line 1: `VimCrypt~01!)�#�'B	2��1)�Ġ��r���H�7�̙��9�Df��hj�[Ai���3f������F�1+Z2�xr7�Jf͸�_�:�,�������˧/#�k�c~Д/S�O�v���g��[��"" �?u�Z��S`�a�mO��i2����;���T6�6=.��Lݦ��G/(��Gդ-t^�k���ܚ����P]��.�l>��?��Ȑ�lo��Z��
ށ%�                                                                                           _�.����\��bC��r������
  m�:��F�C���g��b��c� 	��s�UP<�Y������o�TZ�շ����0�d��r�$��[��v�X����q��-����}4)��&���nm���=�،Q?9����2a��b8鶶���ř�F��}l�������>���C�A��������4=�]x#6����-L����,/0��=�]9�c�dm�@e��<�|���g��Q��0��������E��#�9��勼lc]�q�n��m$����׊�y��~��!�U|�t'
/etc/7dtd.conf: line 1: syntax error near unexpected token `)'
/etc/7dtd.conf: line 1: `VimCrypt~01!)�#�'B	2��1)�Ġ��r���H�7�̙��9�Df��hj�[Ai���3f������F�1+Z2�xr7�Jf͸�_�:�,�������˧/#�k�c~Д/S�O�v���g��[��"" �?u�Z��S`�a�mO��i2����;���T6�6=.��Lݦ��G/(��Gդ-t^�k���ܚ����P]��.�l>��?��Ȑ�lo��Z��
ށ%�                                                                                           _�.����\��bC��r������
  m�:��F�C���g��b��c� 	��s�UP<�Y������o�TZ�շ����0�d��r�$��[��v�X����q��-����}4)��&���nm���=�،Q?9����2a��b8鶶���ř�F��}l�������>���C�A��������4=�]x#6����-L����,/0��=�]9�c�dm�@e��<�|���g��Q��0��������E��#�9��勼lc]�q�n��m$����׊�y��~��!�U|�t'
/usr/local/lib/7dtd/serverconfig.sh: line 1013: sel: command not found
/usr/local/lib/7dtd/serverconfig.sh: line 1013: sel: command not found
/usr/local/lib/7dtd/serverconfig.sh: line 1013: sel: command not found
/usr/local/lib/7dtd/serverconfig.sh: line 1013: sel: command not found ...

 

If I do the setup anyway, the changes are not saved.

 

Anyone an idea?

THX

Link to comment
Share on other sites

Allow normal user start instance?

 

Hello again, another question:

 

How can I allow my fellow players to start and stop the instance without giving them access to the entire server via root or sudo?

Is there a way to allow the user (or the group) "sdtd" only to start the start script so that the instance then runs?

 

Or is there another way to do so?

 

My environment:

V server: Ubuntu 16.04.2 LTS (GNU / Linux 4.4.0-042stab123.1 x86_64)

Link to comment
Share on other sites

How can I allow my fellow players to start and stop the instance without giving them access to the entire server via root or sudo? Is there a way to allow the user (or the group) "sdtd" only to start the start script so that the instance then runs?

 

I would recommend looking at the EXAMPLES section of the sudoers man page. You're looking for something along the lines of...

username ALL=/usr/local/bin/7dtd.sh

 

Or if you want to be more granular...

 

username ALL=/usr/local/bin/7dtd.sh start,/usr/local/bin/7dtd.sh kill

Link to comment
Share on other sites

I would recommend looking at the EXAMPLES section of the sudoers man page. You're looking for something along the lines of...

username ALL=/usr/local/bin/7dtd.sh

 

Or if you want to be more granular...

 

username ALL=/usr/local/bin/7dtd.sh start,/usr/local/bin/7dtd.sh kill

 

Hi SeeJayEmm,

that was it!

 

Big thanks to you!

 

PS: If someone is interested in a automated CMD-Script for Windows to do some basic control via PLink (PuTTY), please ask :).

Link to comment
Share on other sites

Sometimes the server connection fails at start

 

There is still a small problem. Perhaps someone knows the solution:

 

It sometimes happens that I can not connect to the server (with the running network game).

 

The game only returns the error message: "Error: could not connect to server: could not retrieve server information". The log website is not running either.

 

The server has been started and is also running (shows the status).

 

The only thing that helped so far was when I edit the instance (save without changing something is usually enough). Only then I can connect again with the network play and the log web page works again.

 

When i kill the instance this text is coming up:

 

Trying to gracefully shutdown...
/usr/local/lib/7dtd/common.sh: line 210: nc: command not found
Waiting for server to shut down...
1/5
2/5
3/5
4/5
5/5
Failed, force closing server...
Done

 

Unfortunately, I can not say whether this is related, or just coincidence.

Edited by mic (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...

Howdy,

 

Just thought I'd drop by and share another script I created for my server which is based on Alloc's fixes.

 

Source: http://hammondslegacy.com/forum/viewtopic.php?f=40&t=213&p=508#p508

 

Here is a horde notification script for players which I tested on Ubuntu Server 16.04 LTS but should work for most other flavors of Linux since it uses Bash.

 

Create a file such as sdtd-horde-notify.sh and set permissions on it:

 

mkdir -p /var/scripts/prod
touch /var/scripts/prod/sdtd-horde-notify.sh
chown root:root /var/scripts/prod/sdtd-horde-notify.sh
chmod 755 /var/scripts/prod/sdtd-horde-notify.sh

 

Add the following text to the script:

#!/bin/bash
#############################################################
## Name          : sdtd-horde-notify.sh
## Version       : 1.1
## Date          : 2017-05-25
## Author        : LHammonds
## Purpose       : Notify players once a day about approaching horde night.
##     1. Only process this script if there are players online.
##     2. Only process this script if the time is > 5:00 am in-game.
##     3. Finally, send chat message with how many days until horde night.
## Parameters    : #1 = 7dtd server instance name (required)
## Installation  : Run from crontab every few minutes.
## Compatibility : Verified on Ubuntu Server 14.04 thru 16.04 LTS
##                 7 Days to Die, Alpha 15.2
###################### CHANGE LOG ###########################
## DATE       VER WHO WHAT WAS CHANGED
## ---------- --- --- ---------------------------------------
## 2017-05-08 1.0 LTH Created script.
## 2017-05-25 1.1 LTH Added multi-instance support.
#############################################################

## Import standard variables and functions. ##
source /usr/local/lib/7dtd/common.sh

## Check parameter.
if [ "${1}" == "" ]; then
 echo -e "[ERROR] Missing required parameter. Enter the server instance."
 echo -e "Syntax: ${ScriptName} [serverInstance]"
 echo -e "Example 1: ${ScriptName} HamCraft"
 echo -e "Example 2: ${ScriptName} WalkingDead"
 echo -e "Example 3: ${ScriptName} Vanilla"
 echo -e "Here is a list of valid instances:"
 7dtd.sh instances list
 exit 1
else
 InstanceName="${1}"
fi

TempFile="/tmp/sdtd-gettime-${InstanceName}.txt"
LastRun="/tmp/sdtd-lastrun-${InstanceName}.txt"
Hour2Notify=5

## Send ListPlayers command results to a temporary file.
telnetCommand ${InstanceName} "lp" > ${TempFile}
## Get the last line of the file.  Example: Total of 0 in the game
PlayerCount=`tail -n 1 ${TempFile}`
## Get the 3rd column of the line.  Example: 0
PlayerCount=`echo ${PlayerCount} | cut -d' ' -f3`
## Delete the temporary file.
rm ${TempFile}

if [[ ${PlayerCount} == 0 ]]; then
 ## No active players online.  No need to send in-game message.
 echo "[iNFO] No players online, aborting script."
 ## Remove last run file to allow next person online to get the message.
 if [ -f ${LastRun} ]; then
   rm ${LastRun}
 fi
 exit 0
else
 echo "[iNFO] ${PlayerCount} players online."
fi

## Send gettime command results to a temporary file.
telnetCommand ${InstanceName} "gettime" > ${TempFile}

## Get the last line of the file.  Example: Day 115, 05:22
DayLine=`tail -n 1 ${TempFile}`

## Get the 2nd column of the line.  Example: 115,
CurrentDay=`echo ${DayLine} | cut -d' ' -f2`

## Remove the comma.  Example: 115
CurrentDay="${CurrentDay//,}"

## Get the in-game time.  Example: 05:22
CurrentTime=`echo ${DayLine} | cut -d' ' -f3`

## Get the in-game hour.  Example: 05
CurrentHour=`echo ${CurrentTime} | cut -d':' -f1`

## Force number to decimal (base 10) by removing any leading zeroes. Example: 5
CurrentHour=$((10#${CurrentHour}))

## Get the remainder from dividing by 7.  Example: 3
Remainder=`expr ${CurrentDay} % 7`

## Subtract the remainder from 7 to get how many days until the 7th night.
DaysToHorde=`expr 7 - ${Remainder}`

if [[ ${DaysToHorde} == 1 ]]; then
 DayPlural="day"
else
 DayPlural="days"
fi

if [[ ${CurrentHour} -gt ${Hour2Notify} ]]; then
 ## It is not too early in the day to send the notification.
 if [ -f ${LastRun} ]; then
   ## If last message sent was today, abort script.
   PriorDay=`tail -n 1 ${LastRun}`
   if [[ ${PriorDay} == ${CurrentDay} ]]; then
     ## Message already sent today, abort script.
     exit 0
   else
     ## We are in a new day.
     if [[ ${Remainder} == 0 ]]; then
       telnetCommand ${InstanceName} "say \"[ffff00][iNFO] [00ff00]Horde night tonight!\""
     else
       telnetCommand ${InstanceName} "say \"[ffff00][iNFO] [00ff00]${DaysToHorde} ${DayPlural} until horde night.\""
     fi
     ## Create last run file with date when message was sent.
     echo ${CurrentDay} > ${LastRun}
   fi
 else
   ## Messasge not sent today, send the chat message.
   if [[ ${Remainder} == 0 ]]; then
     telnetCommand ${InstanceName} "say \"[ffff00][iNFO] [00ff00]Horde night tonight!\""
   else
     telnetCommand ${InstanceName} "say \"[ffff00][iNFO] [00ff00]${DaysToHorde} ${DayPlural} until horde night.\""
   fi

   ## Create last run file with date when message was sent.
   echo ${CurrentDay} > ${LastRun}
 fi
else
 ## Too early in the morning to message players, abort script.
 exit 0
fi

## Delete the temporary file.
rm ${TempFile}

 

You can then schedule it in the root account (accessible by doing "sudo su" from your admin account) and then type "crontab -e"

 

Example crontab schedule:

########################################
# Name: Crontab Schedule for root user
# Author: LHammonds
############# Update Log ###############
# 2016-01-18 - LTH - Created schedule
########################################
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
#
# Adjust the time clock
#
0 1-23 * * * /usr/sbin/ntpdate ntp.ubuntu.com > /dev/null 2>&1
#
# 7dtd: Notify players each in-game day about approaching horde night
#
*/5 * * * * /var/scripts/prod/sdtd-horde-notify.sh HamCraft > /dev/null 2>&1
*/5 * * * * /var/scripts/prod/sdtd-horde-notify.sh WalkingDead > /dev/null 2>&1
*/5 * * * * /var/scripts/prod/sdtd-horde-notify.sh Vanilla > /dev/null 2>&1

 

Summary of what it is doing:

 

The schedule is configured to run the script every 5 minutes for instances of servers called "HamCraft", "WalkingDead" and "Vanilla"

 

Even though it runs often, it will only generate an in-game message once per day shortly after the desired hour...which is set to 5am in the script via the "Hour2Notify" variable.

 

Here are all the possible messages players will see in the game:

 

[iNFO] 6 days until horde night.

[iNFO] 5 days until horde night.

[iNFO] 4 days until horde night.

[iNFO] 3 days until horde night.

[iNFO] 2 days until horde night.

[iNFO] 1 day until horde night.

[iNFO] Horde night tonight!

Link to comment
Share on other sites

Any working fix for error "Too many open files"?

 

All limits already increased to maximum.

 

Can't use web map. It always cause error on maprender and server become unaccessible.

 

I had this same error forever ago, Sylen or Alloc helped me fix it. I'll have to go back through my posts to find it, but I started using the dynamic map and not rendering the map and it eliminates that issue. I'm at work, give me time and I'll find the post.

 

It was Sylen. Here's a link he shared with me:

 

https://7daystodie.com/forums/showthread.php?40772-SUPPORT-FAQ-Information-and-Common-Solutions#post429948

Edited by Spectral Force (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

I just setup a new Ubuntu 16.04 server and I noticed this message below when I was running bootstrap.sh. I've installed all the prerequisites. Did I do something wrong? Does this message mean anything?

 

 

Downloading and installing management scripts

2017-06-05 20:35:41 URL:[url]http://illy.bz/fi/7dtd/management_scripts.tar.gz[/url] [32851/32851] -> "/tmp/management_scripts.tar.gz" [1]
insserv: pushd() can not change to directory /etc/init.d: No such file or directory
update-rc.d: error: insserv rejected the script header

Compiling start-stop-daemon

 

I also notice that if I try to use the bash auto completion I don't get the results that I get on another server that I setup that's running the scripts. Here's what I get when I type 7dtd.sh [Tab]

 

root@ns544969:~# 7dtd.sh
.bash_history  .bashrc        .cache/        .email         .mdg           .profile       .ssh/          .steam/        Steam/
root@ns544969:~# 7dtd.sh

 

Here's what I am expecting to get. It's what I get on my other server. Any help is appreciated.

 

root@ns532637:~# 7dtd.sh
about          help           kill           status         updatefixes
backup         instances      start          updateengine   updatescripts
root@ns532637:~# 7dtd.sh

Edited by KGM6911 (see edit history)
Link to comment
Share on other sites

Any working fix for error "Too many open files"?

 

All limits already increased to maximum.

 

Can't use web map. It always cause error on maprender and server become unaccessible.

Is it still really giving you that error or are you just having issues with the web map?

I'd bet it's safe to say that if you're really hitting the open files limit you either haven't increased the limit enough or you did something wrong with that.

 

 

 

I just setup a new Ubuntu 16.04 server and I noticed this message below when I was running bootstrap.sh. I've installed all the prerequisites. Did I do something wrong? Does this message mean anything?

 

insserv: pushd() can not change to directory /etc/init.d: No such file or directory
update-rc.d: error: insserv rejected the script header

Looks like the installation failed as there was an issue with /etc/init.d not existing. I suppose that's due to the switch to systemd. In the end it shouldn't matter a lot though, it just means it won't auto start any instances during system boot.

 

I also notice that if I try to use the bash auto completion I don't get the results that I get on another server that I setup that's running the scripts.

Most likely bash-completion is not installed or activated for root.

Link to comment
Share on other sites

Just some a16 Experimental Updates....

 

The script does not create the following items in the config file.

  <property name="BedrollDeadZoneSize"  value="15"/>     
 <property name="BloodMoonEnemyCount"  value="8" />     
 <property name="HideCommandExecutionLog"    value="0"/>   
 <property name="MaxUncoveredMapChunksPerPlayer"  value="131072"/>     
 <property name="ServerAdminSlots"   value="0"/>    
 <property name="ServerAdminSlotsPermission" value="0"/>      
 <property name="ServerDisabledNetworkProtocols" value="UNET"/>      
 <property name="ServerReservedSlots"  value="0"/>     
 <property name="ServerReservedSlotsPermission" value="100"/>      

 

The following line is removed.

  <property name="EnemySenseMemory" value="60"/>

 

Also, just a general note on changes...

 

Default server port has been 26900 for ages, but script still uses 25000.

LandClaim Size default is now 41. I think the script uses either 30 or 7. I can never remember.

 

 

 

Almost forgot, EnemySenseMemory will prevent your server from starting.

OOh, found another one. EnemySpawnMode is not 0-5 or whatever it was. It's True or False. Again, incorrect input will prevent it from starting.

Edited by SylenThunder (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...