Added dynamic injection of telnet port
This commit is contained in:
parent
b169024ccf
commit
0a3c671435
@ -144,7 +144,8 @@ confirmation() {
|
||||
### IMPORTS ###
|
||||
|
||||
### CONSTANTS ###
|
||||
START_PORT_RANGE=50000
|
||||
PRIMARY_START_PORT_RANGE=50000
|
||||
TELNET_START_PORT_RANGE=60000
|
||||
BASE_DIR="${HOME}/7-Days-To-Die"
|
||||
### CONSTANTS ###
|
||||
|
||||
@ -202,6 +203,7 @@ start_server() {
|
||||
local server_directory
|
||||
local server_config
|
||||
local server_save_dir
|
||||
local server_mods_dir
|
||||
local server_name
|
||||
local prefix
|
||||
local server_session_name
|
||||
@ -211,6 +213,7 @@ start_server() {
|
||||
server_config="${server_directory}/serverconfig.xml"
|
||||
server_save_dir="${server_directory}/Saves/"
|
||||
server_userdata_dir="${server_directory}/UserData"
|
||||
server_mods_dir="${server_directory}/mods"
|
||||
prefix="7D2D"
|
||||
server_session_name="${prefix}-${server_name}"
|
||||
|
||||
@ -221,11 +224,15 @@ start_server() {
|
||||
backup_configs "${server_directory}"
|
||||
|
||||
local server_port
|
||||
server_port="$((START_PORT_RANGE + server_id))"
|
||||
server_port="$((PRIMARY_START_PORT_RANGE + server_id))"
|
||||
|
||||
local telnet_port
|
||||
telnet_port="$(( TELNET_START_PORT_RANGE + server_id ))"
|
||||
|
||||
log "info" "Generating a few required directories in $(important "${server_directory}")"
|
||||
mkdir -p "${server_save_dir}"
|
||||
mkdir -p "${server_userdata_dir}"
|
||||
mkdir -p "${server_mods_dir}"
|
||||
|
||||
log "info" "Configuring $(important "serverconfig.xml")"
|
||||
|
||||
@ -244,6 +251,9 @@ start_server() {
|
||||
# base of the server directory
|
||||
elif [[ "${REPLY}" = *"property name=\"AdminFileName\""* ]]; then
|
||||
printf "\t%s\n" "<property name=\"AdminFileName\" value=\"../serveradmin.xml\" />"
|
||||
# Manage the telnet tags
|
||||
elif [[ "${REPLY}" = *"property name=\"TelnetPort\""* ]]; then
|
||||
printf "\t%s\n" "<property name=\"TelnetPort\"" value=\"${telnet_port}\"" />"
|
||||
else
|
||||
printf "%s\n" "${REPLY}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user