Browse Source

feat(newserver): soulmask (#4590)

* feat: reference new smserver

* feat: add default config

* feat: add stop command using telnet

* fix: remove duplicate unused telnetpassword var

* feat: add soulmask to config & info functions

* fix: remove ini config for now

* fix: startparameter initialization fix

* feat: remove pve fixed param in startparameters

* fix: update default gamelogdir

* fix: handle telnet response during stop process

* add sm fix

* add fix_sm.sh

* add ss command

* and

* add memory requirements

* adjust start parameters

* remove telnetpassword

* add backup interval

a

* comments

* rename variables to telnetpassword

* var name change

---------

Co-authored-by: Daniel Gibbs <[email protected]>
pull/4605/head
Thomas S 10 months ago
committed by GitHub
parent
commit
493a3a82fa
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 189
      lgsm/config-default/config-lgsm/smserver/_default.cfg
  2. 2
      lgsm/config-default/config-lgsm/tfserver/_default.cfg
  3. 5
      lgsm/config-default/config-lgsm/vhserver/_default.cfg
  4. 1
      lgsm/data/almalinux-8.csv
  5. 1
      lgsm/data/almalinux-9.csv
  6. 1
      lgsm/data/centos-7.csv
  7. 1
      lgsm/data/centos-8.csv
  8. 1
      lgsm/data/centos-9.csv
  9. 1
      lgsm/data/debian-10.csv
  10. 1
      lgsm/data/debian-11.csv
  11. 1
      lgsm/data/debian-12.csv
  12. 1
      lgsm/data/debian-9.csv
  13. 1
      lgsm/data/rhel-7.csv
  14. 1
      lgsm/data/rhel-8.csv
  15. 1
      lgsm/data/rhel-9.csv
  16. 1
      lgsm/data/rocky-8.csv
  17. 1
      lgsm/data/rocky-9.csv
  18. 1
      lgsm/data/serverlist.csv
  19. 1
      lgsm/data/ubuntu-16.04.csv
  20. 1
      lgsm/data/ubuntu-18.04.csv
  21. 1
      lgsm/data/ubuntu-20.04.csv
  22. 1
      lgsm/data/ubuntu-22.04.csv
  23. 1
      lgsm/data/ubuntu-23.04.csv
  24. 1
      lgsm/data/ubuntu-23.10.csv
  25. 1
      lgsm/data/ubuntu-24.04.csv
  26. 4
      lgsm/modules/check_system_requirements.sh
  27. 1
      lgsm/modules/command_dev_parse_game_details.sh
  28. 2
      lgsm/modules/command_dev_query_raw.sh
  29. 107
      lgsm/modules/command_stop.sh
  30. 5
      lgsm/modules/core_modules.sh
  31. 2
      lgsm/modules/fix.sh
  32. 10
      lgsm/modules/fix_sm.sh
  33. 17
      lgsm/modules/info_game.sh
  34. 32
      lgsm/modules/info_messages.sh
  35. 3
      lgsm/modules/install_config.sh

189
lgsm/config-default/config-lgsm/smserver/_default.cfg

@ -0,0 +1,189 @@
##################################
######## Default Settings ########
##################################
# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
# Copy settings from here and use them in either:
# common.cfg - applies settings to every instance.
# [instance].cfg - applies settings to a specific instance.
#### Game Server Settings ####
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
servername="LinuxGSM"
serverpassword=""
adminpassword=""
port="8777"
queryport="27015"
telnetport="18888"
maxplayers="50"
backupinterval="15" # Backup interval in minutes.
defaultmap="Level01_Main"
## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="WS ${defaultmap} -MultiHome=${ip} -Port=${port} -EchoPort=${telnetport} -QueryPort=${queryport} -SteamServerName='${servername}' -PSW='${serverpassword}' -adminpsw='${adminpassword}' -MaxPlayers=${maxplayers} -initbackup -backupinterval=${backupinterval} -UTF8Output -forcepassthrough -log"
#### LinuxGSM Settings ####
## LinuxGSM Stats
# Send useful stats to LinuxGSM developers.
# https://docs.linuxgsm.com/configuration/linuxgsm-stats
# (on|off)
stats="off"
## Notification Alerts
# (on|off)
# Display IP | https://docs.linuxgsm.com/alerts#display-ip
displayip=""
# More info | https://docs.linuxgsm.com/alerts#more-info
postalert="off"
# Alert on Start/Stop/Restart
statusalert="off"
# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
discordalert="off"
discordwebhook="webhook"
# Email Alerts | https://docs.linuxgsm.com/alerts/email
emailalert="off"
email="[email protected]"
emailfrom=""
# Gotify Alerts | https://docs.linuxgsm.com/alerts/gotify
gotifyalert="off"
gotifytoken="token"
gotifywebhook="webhook"
# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
iftttalert="off"
ifttttoken="accesstoken"
iftttevent="linuxgsm_alert"
# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
pushbulletalert="off"
pushbullettoken="accesstoken"
channeltag=""
# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
pushoveralert="off"
pushovertoken="accesstoken"
pushoveruserkey="userkey"
# Rocket.Chat Alerts | https://docs.linuxgsm.com/alerts/rocket.chat
rocketchatalert="off"
rocketchatwebhook="webhook"
# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
slackalert="off"
slackwebhook="webhook"
# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
# You can add a custom cURL string eg proxy (useful in Russia) in "curlcustomstring".
# For example "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help all".
telegramapi="api.telegram.org"
telegramalert="off"
telegramtoken="accesstoken"
telegramchatid=""
telegramthreadid=""
telegramsilentnotification="false"
curlcustomstring=""
## Updating | https://docs.linuxgsm.com/commands/update
updateonstart="off"
## Backup | https://docs.linuxgsm.com/commands/backup
maxbackups="4"
maxbackupdays="30"
stoponbackup="on"
## Logging | https://docs.linuxgsm.com/features/logging
consolelogging="on"
logdays="7"
## Monitor | https://docs.linuxgsm.com/commands/monitor
# Query delay time
querydelay="5"
## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
ansi="on"
#### Advanced Settings ####
## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
sleeptime="0.5"
## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd
# Server appid
appid="3017300"
steamcmdforcewindows="no"
# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
branch=""
betapassword=""
# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
steammaster="true"
## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
# 1: tmux kill
# 2: CTRL+c
# 3: quit
# 4: quit 120s
# 5: stop
# 6: q
# 7: exit
# 8: 7 Days to Die
# 9: GoldSrc
# 10: Avorion
# 11: end
# 12: shutdown
# 13: soulmask
stopmode="13"
## Query mode
# 1: session only
# 2: gamedig (gsquery fallback)
# 3: gamedig
# 4: gsquery
# 5: tcp
querymode="2"
querytype="protocol-valve"
## Console type
consoleverbose="yes"
consoleinteract="no"
## Game Server Details
# Do not edit
gamename="Soulmask"
engine="unreal4"
glibc="2.17"
#### Directories ####
# Edit with care
## Game Server Directories
systemdir="${serverfiles}/WS"
executabledir="${systemdir}/Binaries/Linux"
executable="./WSServer-Linux-Shipping"
## Backup Directory
backupdir="${lgsmdir}/backup"
## Logging Directories
[ -n "${LGSM_LOGDIR}" ] && logdir="${LGSM_LOGDIR}" || logdir="${rootdir}/log"
gamelogdir="${systemdir}/WS/Saved/Logs"
lgsmlogdir="${logdir}/script"
consolelogdir="${logdir}/console"
lgsmlog="${lgsmlogdir}/${selfname}-script.log"
consolelog="${consolelogdir}/${selfname}-console.log"
alertlog="${lgsmlogdir}/${selfname}-alert.log"
postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
## Logs Naming
lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
## Log Parameters
logtimestamp="off"
logtimestampformat="%Y-%m-%d %H:%M:%S"

2
lgsm/config-default/config-lgsm/tfserver/_default.cfg

@ -25,7 +25,7 @@ greenhand="true"
maxplayers="40" maxplayers="40"
maxqueuesize="50" maxqueuesize="50"
queuevalidtime="120" queuevalidtime="120"
saveinterval="300" saveinterval="300" # Auto-save in seconds.
serveradmins="" # Use 17-digit Steam IDs separated by commas to grant admin privileges to players. serveradmins="" # Use 17-digit Steam IDs separated by commas to grant admin privileges to players.
servername="LinuxGSM" servername="LinuxGSM"
serverpassword="" serverpassword=""

5
lgsm/config-default/config-lgsm/vhserver/_default.cfg

@ -10,14 +10,13 @@
## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters ## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
servername="LinuxGSM" servername="LinuxGSM"
# Minimum password length is 5. serverpassword="" # Minimum password length is 5.
serverpassword=""
port="2456" port="2456"
worldname="${selfname}" worldname="${selfname}"
public="1" public="1"
savedir="$HOME/.config/unity3d/IronGate/Valheim" savedir="$HOME/.config/unity3d/IronGate/Valheim"
logFile="" logFile=""
saveinterval="1800" saveinterval="1800" # Auto-save in seconds.
backups="4" backups="4"
backupshort="7200" backupshort="7200"
backuplong="43200" backuplong="43200"

1
lgsm/data/almalinux-8.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/almalinux-9.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-7.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-8.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/centos-9.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-10.csv

@ -104,6 +104,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 4.

1
lgsm/data/debian-11.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-12.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/debian-9.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-7.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-8.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rhel-9.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rocky-8.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/rocky-9.csv

@ -105,6 +105,7 @@ scpslsm
sdtd,telnet,expect,libxml2 sdtd,telnet,expect,libxml2
sf sf
sfc,ncurses-libs.i686 sfc,ncurses-libs.i686
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/serverlist.csv

@ -104,6 +104,7 @@ scpslsm,scpslsmserver,SCP: Secret Laboratory ServerMod,ubuntu-22.04
sdtd,sdtdserver,7 Days to Die,ubuntu-22.04 sdtd,sdtdserver,7 Days to Die,ubuntu-22.04
sf,sfserver,Satisfactory,ubuntu-22.04 sf,sfserver,Satisfactory,ubuntu-22.04
sfc,sfcserver,SourceForts Classic,ubuntu-22.04 sfc,sfcserver,SourceForts Classic,ubuntu-22.04
sm,smserver,Soulmask,ubuntu-22.04
sof2,sof2server,Soldier Of Fortune 2: Gold Edition,ubuntu-22.04 sof2,sof2server,Soldier Of Fortune 2: Gold Edition,ubuntu-22.04
sol,solserver,Soldat,ubuntu-22.04 sol,solserver,Soldat,ubuntu-22.04
squad,squadserver,Squad,ubuntu-22.04 squad,squadserver,Squad,ubuntu-22.04

Can't render this file because it has a wrong number of fields in line 47.

1
lgsm/data/ubuntu-16.04.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-18.04.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-20.04.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-22.04.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-23.04.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-23.10.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

1
lgsm/data/ubuntu-24.04.csv

@ -105,6 +105,7 @@ scpslsm,mono-complete
sdtd,telnet,expect,libxml2-utils sdtd,telnet,expect,libxml2-utils
sf sf
sfc,libtinfo5:i386 sfc,libtinfo5:i386
sm,telnet,expect
sof2 sof2
sol sol
squad squad

Can't render this file because it has a wrong number of fields in line 2.

4
lgsm/modules/check_system_requirements.sh

@ -9,7 +9,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
info_distro.sh info_distro.sh
# RAM requirements in megabytes for each game or engine. # RAM requirements in gigabytes for each game or engine.
if [ "${shortname}" == "ark" ]; then if [ "${shortname}" == "ark" ]; then
ramrequirementgb="7" ramrequirementgb="7"
@ -49,6 +49,8 @@ elif [ "${shortname}" == "sf" ]; then
ramrequirementgb="12" ramrequirementgb="12"
elif [ "${shortname}" == "squad" ]; then elif [ "${shortname}" == "squad" ]; then
ramrequirementgb="2" ramrequirementgb="2"
elif [ "${shortname}" == "sm" ]; then
ramrequirementgb="10"
elif [ "${shortname}" == "st" ]; then elif [ "${shortname}" == "st" ]; then
ramrequirementgb="1" ramrequirementgb="1"
elif [ "${shortname}" == "stn" ]; then elif [ "${shortname}" == "stn" ]; then

1
lgsm/modules/command_dev_parse_game_details.sh

@ -112,7 +112,6 @@ declare -A server_details=(
['Steamworks Port']="${steamworksport}" ['Steamworks Port']="${steamworksport}"
['Telnet Enabled']="${telnetenabled}" ['Telnet Enabled']="${telnetenabled}"
['Telnet IP']="${telnetip}" ['Telnet IP']="${telnetip}"
['Telnet Password']="${telnetpass}"
['Telnet Password']="${telnetpassword}" ['Telnet Password']="${telnetpassword}"
['Telnet Port']="${telnetport}" ['Telnet Port']="${telnetport}"
['Tickrate']="${tickrate}" ['Tickrate']="${tickrate}"

2
lgsm/modules/command_dev_query_raw.sh

@ -207,7 +207,7 @@ echo -e ""
echo -e "${lightgreen}Gamedig Raw Output${default}" echo -e "${lightgreen}Gamedig Raw Output${default}"
fn_messages_separator fn_messages_separator
echo -e "" echo -e ""
if [ ! "$(command -v gamedig 2> /dev/null)" ] || [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then if [ ! "$(command -v gamedig 2> /dev/null)" ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
fn_print_failure_nl "gamedig not installed" fn_print_failure_nl "gamedig not installed"
fi fi
if [ ! "$(command -v jq 2> /dev/null)" ]; then if [ ! "$(command -v jq 2> /dev/null)" ]; then

107
lgsm/modules/command_stop.sh

@ -96,8 +96,8 @@ fn_stop_graceful_goldsrc() {
# telnet command for sdtd graceful shutdown. # telnet command for sdtd graceful shutdown.
fn_stop_graceful_sdtd_telnet() { fn_stop_graceful_sdtd_telnet() {
if [ -z "${telnetpass}" ] || [ "${telnetpass}" == "NOT SET" ]; then if [ -z "${telnetpassword}" ] || [ "${telnetpassword}" == "NOT SET" ]; then
sdtd_telnet_shutdown=$(expect -c ' sdtdtelnetshutdown=$(expect -c '
proc abort {} { proc abort {} {
puts "Timeout or EOF\n" puts "Timeout or EOF\n"
exit 1 exit 1
@ -111,14 +111,14 @@ fn_stop_graceful_sdtd_telnet() {
puts "Completed.\n" puts "Completed.\n"
') ')
else else
sdtd_telnet_shutdown=$(expect -c ' sdtdtelnetshutdown=$(expect -c '
proc abort {} { proc abort {} {
puts "Timeout or EOF\n" puts "Timeout or EOF\n"
exit 1 exit 1
} }
spawn telnet '"${telnetip}"' '"${telnetport}"' spawn telnet '"${telnetip}"' '"${telnetport}"'
expect { expect {
"password:" { send "'"${telnetpass}"'\r" } "password:" { send "'"${telnetpassword}"'\r" }
default abort default abort
} }
expect { expect {
@ -143,8 +143,8 @@ fn_stop_graceful_sdtd() {
fn_print_dots "Graceful: telnet: ${telnetip}:${telnetport}" fn_print_dots "Graceful: telnet: ${telnetip}:${telnetport}"
fn_script_log_info "Graceful: telnet: ${telnetip}:${telnetport}" fn_script_log_info "Graceful: telnet: ${telnetip}:${telnetport}"
fn_stop_graceful_sdtd_telnet fn_stop_graceful_sdtd_telnet
completed=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Completed.") completed=$(echo -en "\n ${sdtdtelnetshutdown}" | grep "Completed.")
refused=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Timeout or EOF") refused=$(echo -en "\n ${sdtdtelnetshutdown}" | grep "Timeout or EOF")
if [ "${refused}" ]; then if [ "${refused}" ]; then
fn_print_error "Graceful: telnet: ${telnetip}:${telnetport} : " fn_print_error "Graceful: telnet: ${telnetip}:${telnetport} : "
fn_print_fail_eol_nl fn_print_fail_eol_nl
@ -159,7 +159,7 @@ fn_stop_graceful_sdtd() {
if [ "${completed}" ]; then if [ "${completed}" ]; then
for seconds in {1..30}; do for seconds in {1..30}; do
fn_stop_graceful_sdtd_telnet fn_stop_graceful_sdtd_telnet
refused=$(echo -en "\n ${sdtd_telnet_shutdown}" | grep "Timeout or EOF") refused=$(echo -en "\n ${sdtdtelnetshutdown}" | grep "Timeout or EOF")
if [ "${refused}" ]; then if [ "${refused}" ]; then
fn_print_ok "Graceful: telnet: ${telnetip}:${telnetport} : " fn_print_ok "Graceful: telnet: ${telnetip}:${telnetport} : "
fn_print_ok_eol_nl fn_print_ok_eol_nl
@ -185,7 +185,7 @@ fn_stop_graceful_sdtd() {
fi fi
echo -en "\n" | tee -a "${lgsmlog}" echo -en "\n" | tee -a "${lgsmlog}"
echo -en "Telnet output:" | tee -a "${lgsmlog}" echo -en "Telnet output:" | tee -a "${lgsmlog}"
echo -en "\n ${sdtd_telnet_shutdown}" | tee -a "${lgsmlog}" echo -en "\n ${sdtdtelnetshutdown}" | tee -a "${lgsmlog}"
echo -en "\n\n" | tee -a "${lgsmlog}" echo -en "\n\n" | tee -a "${lgsmlog}"
fi fi
else else
@ -195,6 +195,95 @@ fn_stop_graceful_sdtd() {
fi fi
} }
# Attempts graceful shutdown of Soulmask using telnet.
fn_stop_graceful_sm() {
fn_print_dots "Graceful: telnet"
fn_script_log_info "Graceful: telnet"
if [ "${telnetenabled}" == "false" ]; then
fn_print_info_nl "Graceful: telnet: DISABLED: Enable in ${servercfg}"
elif [ "$(command -v expect 2> /dev/null)" ]; then
# Tries to shutdown with both localhost and server IP.
for telnetip in 127.0.0.1 ${ip}; do
fn_print_dots "Graceful: telnet: ${telnetip}:${telnetport}"
fn_script_log_info "Graceful: telnet: ${telnetip}:${telnetport}"
fn_stop_graceful_sm_telnet
completed=$(echo -en "\n ${smtelnetshutdown}" | grep "Completed.")
refused=$(echo -en "\n ${smtelnetshutdown}" | grep "Timeout or EOF")
if [ "${refused}" ]; then
fn_print_error "Graceful: telnet: ${telnetip}:${telnetport} : "
fn_print_fail_eol_nl
fn_script_log_error "Graceful: telnet: ${telnetip}:${telnetport} : FAIL"
elif [ "${completed}" ]; then
break
fi
done
# If telnet shutdown was successful will use telnet again to check
# the connection has closed, confirming that the tmux session can now be killed.
if [ "${completed}" ]; then
for seconds in {1..30}; do
fn_stop_graceful_sm_telnet
refused=$(echo -en "\n ${smtelnetshutdown}" | grep "Timeout or EOF")
if [ "${refused}" ]; then
fn_print_ok "Graceful: telnet: ${telnetip}:${telnetport} : "
fn_print_ok_eol_nl
fn_script_log_pass "Graceful: telnet: ${telnetip}:${telnetport} : ${seconds} seconds"
if [ "${statusalert}" == "on" ] && [ "${firstcommandname}" == "STOP" ]; then
alert="stopped"
alert.sh
fi
break
fi
fn_sleep_time_1
fn_print_dots "Graceful: telnet: ${seconds}"
done
# If telnet shutdown fails, show it and stop
else
if [ "${refused}" ]; then
fn_print_error "Graceful: telnet: "
fn_print_fail_eol_nl
fn_script_log_error "Graceful: telnet: ${telnetip}:${telnetport} : FAIL"
else
fn_print_error_nl "Graceful: telnet: Unknown error"
fn_script_log_error "Graceful: telnet: Unknown error"
fi
echo -en "\n" | tee -a "${lgsmlog}"
echo -en "Telnet output:" | tee -a "${lgsmlog}"
echo -en "\n ${smtelnetshutdown}" | tee -a "${lgsmlog}"
echo -en "\n\n" | tee -a "${lgsmlog}"
fi
else
fn_print_warn "Graceful: telnet: expect not installed: "
fn_print_fail_eol_nl
fn_script_log_warn "Graceful: telnet: expect not installed: FAIL"
fi
}
# telnet command for soulmask graceful shutdown.
fn_stop_graceful_sm_telnet() {
smtelnetshutdown=$(expect -c '
proc abort {} {
puts "Timeout or EOF\n"
exit 1
}
spawn telnet '"${telnetip}"' '"${telnetport}"'
expect {
"Hello:" { send "saveworld 1\r" }
default abort
}
expect {
"the world is saved." { send "quit 1\r" }
default abort
}
expect {
"World is closing..." {}
default abort
}
expect { eof }
puts "Completed.\n"
')
}
# Attempts graceful shutdown by sending /save /stop. # Attempts graceful shutdown by sending /save /stop.
fn_stop_graceful_avorion() { fn_stop_graceful_avorion() {
fn_print_dots "Graceful: /save /stop" fn_print_dots "Graceful: /save /stop"
@ -253,6 +342,8 @@ fn_stop_graceful_select() {
fn_stop_graceful_cmd "end" 30 fn_stop_graceful_cmd "end" 30
elif [ "${stopmode}" == "12" ]; then elif [ "${stopmode}" == "12" ]; then
fn_stop_graceful_cmd "shutdown" 30 fn_stop_graceful_cmd "shutdown" 30
elif [ "${stopmode}" == "13" ]; then
fn_stop_graceful_sm
fi fi
} }

5
lgsm/modules/core_modules.sh

@ -446,6 +446,11 @@ fix_sfc.sh() {
fn_fetch_module fn_fetch_module
} }
fix_sm.sh() {
modulefile="${FUNCNAME[0]}"
fn_fetch_module
}
fix_st.sh() { fix_st.sh() {
modulefile="${FUNCNAME[0]}" modulefile="${FUNCNAME[0]}"
fn_fetch_module fn_fetch_module

2
lgsm/modules/fix.sh

@ -52,7 +52,7 @@ fn_apply_fix() {
fi fi
} }
apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins kf nmrih onset pvr ro rust rw samp sdtd sfc sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm zmr) apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins kf nmrih onset pvr ro rust rw samp sdtd sfc sm sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm zmr)
apply_post_install_fix=(av kf kf2 ro ut2k4 ut ut3) apply_post_install_fix=(av kf kf2 ro ut2k4 ut ut3)
# validate registered fixes for safe development # validate registered fixes for safe development

10
lgsm/modules/fix_sm.sh

@ -0,0 +1,10 @@
#!/bin/bash
# LinuxGSM fix_sm.sh module
# Author: Daniel Gibbs
# Contributors: http://linuxgsm.com/contrib
# Website: https://linuxgsm.com
# Description: Resolves issues with Unturned.
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/linux64"

17
lgsm/modules/info_game.sh

@ -1970,7 +1970,7 @@ fn_info_game_sdtd() {
telnetenabled="${telnetenabled:-"NOT SET"}" telnetenabled="${telnetenabled:-"NOT SET"}"
# Telnet IP will be localhost if no password is set # Telnet IP will be localhost if no password is set
# check_ip will set the IP first. This will overwrite it. # check_ip will set the IP first. This will overwrite it.
if [ -z "${telnetpass}" ]; then if [ -z "${telnetpassword}" ]; then
telnetip="127.0.0.1" telnetip="127.0.0.1"
fi fi
telnetpass="${telnetpass:-"NOT SET"}" telnetpass="${telnetpass:-"NOT SET"}"
@ -1988,6 +1988,19 @@ fn_info_game_sf() {
beaconport="${beaconport:-"0"}" beaconport="${beaconport:-"0"}"
} }
# Config Type: Parameters (with an ini)
fn_info_game_sm() {
servername="${servername:-"NOT SET"}"
adminpassword="${adminpassword:-"NOT SET"}"
port="${port:-"0"}"
queryport="${queryport:-"0"}"
maxplayers="${maxplayers:-"0"}"
# telnet config
telnetenabled=true
telnetip="127.0.0.1"
telnetport="${telnetport:-"0"}"
}
# Config Type: QuakeC # Config Type: QuakeC
# Comment: // or /* */ # Comment: // or /* */
# Example: set sv_hostname "SERVERNAME" # Example: set sv_hostname "SERVERNAME"
@ -2407,6 +2420,8 @@ elif [ "${shortname}" == "sdtd" ]; then
fn_info_game_sdtd fn_info_game_sdtd
elif [ "${shortname}" == "sf" ]; then elif [ "${shortname}" == "sf" ]; then
fn_info_game_sf fn_info_game_sf
elif [ "${shortname}" == "sm" ]; then
fn_info_game_sm
elif [ "${shortname}" == "sof2" ]; then elif [ "${shortname}" == "sof2" ]; then
fn_info_game_sof2 fn_info_game_sof2
elif [ "${shortname}" == "sol" ]; then elif [ "${shortname}" == "sol" ]; then

32
lgsm/modules/info_messages.sh

@ -30,8 +30,8 @@ fn_info_messages_password_strip() {
httppassword="********" httppassword="********"
fi fi
if [ "${telnetpass}" ]; then if [ "${telnetpassword}" ]; then
telnetpass="********" telnetpassword="********"
fi fi
if [ "${wsapikey}" ]; then if [ "${wsapikey}" ]; then
@ -483,6 +483,11 @@ fn_info_messages_gameserver() {
echo -e "${lightblue}Version Count:\t${default}${versioncount}" echo -e "${lightblue}Version Count:\t${default}${versioncount}"
fi fi
# backupinterval (Soulmask)
if [ -n "${backupinterval}" ]; then
echo -e "${lightblue}Backup Interval:\t${default}${backupinterval}"
fi
# Listed on Master server # Listed on Master server
if [ -n "${displaymasterserver}" ]; then if [ -n "${displaymasterserver}" ]; then
if [ "${displaymasterserver}" == "true" ]; then if [ "${displaymasterserver}" == "true" ]; then
@ -702,6 +707,8 @@ fn_info_messages_ports() {
portcommand="ss -tuplwn | grep java" portcommand="ss -tuplwn | grep java"
elif [ "${shortname}" == "terraria" ]; then elif [ "${shortname}" == "terraria" ]; then
portcommand="ss -tuplwn | grep Main" portcommand="ss -tuplwn | grep Main"
elif [ "${shortname}" == "sm" ]; then
portcommand="ss -tuplwn | grep WSServer-Linux"
elif [ "${engine}" == "source" ]; then elif [ "${engine}" == "source" ]; then
portcommand="ss -tuplwn | grep srcds_linux" portcommand="ss -tuplwn | grep srcds_linux"
elif [ "${engine}" == "goldsrc" ]; then elif [ "${engine}" == "goldsrc" ]; then
@ -1435,7 +1442,7 @@ fn_info_messages_sdtd() {
{ {
echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}" echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
echo -e "${lightblue}Telnet address:\t${default}${telnetip} ${telnetport}" echo -e "${lightblue}Telnet address:\t${default}${telnetip} ${telnetport}"
echo -e "${lightblue}Telnet password:\t${default}${telnetpass}" echo -e "${lightblue}Telnet password:\t${default}${telnetpassword}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }
@ -1448,6 +1455,23 @@ fn_info_messages_sf() {
} | column -s $'\t' -t } | column -s $'\t' -t
} }
fn_info_messages_sm() {
fn_info_messages_password_strip
{
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
fn_port "Telnet" telnetport tcp
} | column -s $'\t' -t
echo -e ""
echo -e "${bold}${lightgreen}${gamename} Telnet${default}"
fn_messages_separator
{
echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
echo -e "${lightblue}Telnet address:\t${default}${telnetip} ${telnetport}"
} | column -s $'\t' -t
}
fn_info_messages_sof2() { fn_info_messages_sof2() {
{ {
fn_port "header" fn_port "header"
@ -1842,6 +1866,8 @@ fn_info_messages_select_engine() {
fn_info_messages_sdtd fn_info_messages_sdtd
elif [ "${shortname}" == "sf" ]; then elif [ "${shortname}" == "sf" ]; then
fn_info_messages_sf fn_info_messages_sf
elif [ "${shortname}" == "sm" ]; then
fn_info_messages_sm
elif [ "${shortname}" == "sof2" ]; then elif [ "${shortname}" == "sof2" ]; then
fn_info_messages_sof2 fn_info_messages_sof2
elif [ "${shortname}" == "sol" ]; then elif [ "${shortname}" == "sol" ]; then

3
lgsm/modules/install_config.sh

@ -695,6 +695,9 @@ elif [ "${shortname}" == "sf" ]; then
fn_default_config_remote fn_default_config_remote
fn_set_config_vars fn_set_config_vars
fn_list_config_locations fn_list_config_locations
elif [ "${shortname}" == "sm" ]; then
fn_default_config_local
fn_list_config_locations
elif [ "${shortname}" == "sol" ]; then elif [ "${shortname}" == "sol" ]; then
array_configs+=(soldat.ini) array_configs+=(soldat.ini)
fn_fetch_default_config fn_fetch_default_config

Loading…
Cancel
Save