Skip to content

Commit fce9f65

Browse files
authored
feat(monitor): prepare for gamedig 5 (#4510)
* feat: gamedig 5 * install gamedig in lgsm dir if node exists * and * use local gamedig version * local * palworld * pw query port * mbe * fix ro system system a * public ip * jc2m * fix(ti): update default map The default map in the tiserver configuration file has been updated from "/Game/TheIsle/Maps/Game/Isla_Spiro/Isla_Spiro" to "/Game/TheIsle/Maps/Game/Gateway/Gateway". This change ensures that the server starts with the correct default map. * fix: _default.cfg NOT SET * download package.json and run npm install * update samp * disable query for squad * correct name * feat: update querymode and querytype in server configs Changed querymode to 3 and set querytype to "eco" for ecoserver. Updated querymode to 2 and changed querytype to "protocol-valve" for sdtdserver. * feat: add new port command for bfv game Added a new port command for the "bfv" game in the info_messages script. * queryport eco * add eco rconport * adding message * if node 16 or above * rename to check_gamedig
1 parent 476ed02 commit fce9f65

23 files changed

+839
-65
lines changed

Diff for: lgsm/config-default/config-lgsm/ecoserver/_default.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ stopmode="2"
131131
# 3: gamedig
132132
# 4: gsquery
133133
# 5: tcp
134-
querymode="1"
135-
querytype=""
134+
querymode="3"
135+
querytype="eco"
136136

137137
## Console type
138138
consoleverbose="yes"

Diff for: lgsm/config-default/config-lgsm/jc2server/_default.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ stopmode="2"
132132
# 4: gsquery
133133
# 5: tcp
134134
querymode="2"
135-
querytype="jc2mp"
135+
querytype="jc2m"
136136

137137
## Console type
138138
consoleverbose="yes"

Diff for: lgsm/config-default/config-lgsm/mcbserver/_default.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ stopmode="5"
125125
# 4: gsquery
126126
# 5: tcp
127127
querymode="2"
128-
querytype="minecraftbe"
128+
querytype="mbe"
129129

130130
## Console type
131131
consoleverbose="yes"

Diff for: lgsm/config-default/config-lgsm/pwserver/_default.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ stopmode="2"
139139
# 3: gamedig
140140
# 4: gsquery
141141
# 5: tcp
142-
querymode="1"
143-
querytype="1"
142+
querymode="3"
143+
querytype="palworld"
144144

145145
## Console type
146146
consoleverbose="yes"

Diff for: lgsm/config-default/config-lgsm/sampserver/_default.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ stopmode="2"
123123
# 4: gsquery
124124
# 5: tcp
125125
querymode="3"
126-
querytype="samp"
126+
querytype="gtasam"
127127

128128
## Console type
129129
consoleverbose="no"

Diff for: lgsm/config-default/config-lgsm/sdtdserver/_default.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ stopmode="8"
134134
# 3: gamedig
135135
# 4: gsquery
136136
# 5: tcp
137-
querymode="5"
137+
querymode="2"
138138
querytype="protocol-valve"
139139

140140
## Console type

Diff for: lgsm/config-default/config-lgsm/squadserver/_default.cfg

+2-2
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ stopmode="2"
136136
# 3: gamedig
137137
# 4: gsquery
138138
# 5: tcp
139-
querymode="2"
140-
querytype="protocol-valve"
139+
querymode="1"
140+
querytype=""
141141

142142
## Console type
143143
consoleverbose="yes"

Diff for: lgsm/modules/check.sh

+7
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ for allowed_command in "${allowed_commands_array[@]}"; do
9999
check_system_requirements.sh
100100
fi
101101
done
102+
103+
allowed_commands_array=(DETAILS MONITOR START STOP UPDATE VALIDATE POST-DETAILS)
104+
for allowed_command in "${allowed_commands_array[@]}"; do
105+
if [ "${allowed_command}" == "${commandname}" ]; then
106+
check_gamedig.sh
107+
fi
108+
done

Diff for: lgsm/modules/check_gamedig.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# LinuxGSM check_gamedig.sh module
3+
# Author: Daniel Gibbs
4+
# Contributors: http://linuxgsm.com/contrib
5+
# Website: https://linuxgsm.com
6+
# Description: Installs nodejs and gamedig
7+
8+
if [ "$(command -v node)" ] && [ "$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)" -ge 16 ] && [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
9+
echo -e ""
10+
echo -e "${bold}${lightyellow}Installing Gamedig${default}"
11+
fn_script_log_info "Installing Gamedig"
12+
cd "${lgsmdir}" || exit
13+
wget -N --no-check-certificate "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${githubbranch}/package.json"
14+
npm install
15+
fi

Diff for: lgsm/modules/check_ip.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,25 @@ function fn_is_valid_ip() {
3838

3939
# If the IP variable has been set by user.
4040
if fn_is_valid_ip "${ip}"; then
41-
queryips=("${ip}")
41+
queryips=("${ip}" "${publicip}")
4242
httpip=("${ip}")
4343
telnetip=("${ip}")
4444
# If the game config has an IP set.
4545
elif fn_is_valid_ip "${configip}"; then
46-
queryips=("${configip}")
46+
queryips=("${configip}" "${publicip}")
4747
ip="${configip}"
4848
httpip=("${configip}")
4949
telnetip=("${configip}")
5050
# If there is only 1 server IP address.
5151
# Some IP details can automatically use the one IP.
5252
elif [ "${#current_ips[@]}" == "1" ]; then
53-
queryips=("127.0.0.1" "${current_ips[@]}")
53+
queryips=("127.0.0.1" "${current_ips[@]}" "${publicip}")
5454
ip="0.0.0.0"
5555
httpip=("${current_ips[@]}")
5656
telnetip=("${current_ips[@]}")
5757
# If no ip is set by the user and server has more than one IP.
5858
else
59-
queryips=("127.0.0.1" "${current_ips[@]}")
59+
queryips=("127.0.0.1" "${current_ips[@]}" "${publicip}")
6060
ip="0.0.0.0"
6161
httpip=("${ip}")
6262
telnetip=("${ip}")

Diff for: lgsm/modules/command_dev_query_raw.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ echo -e ""
207207
echo -e "${lightgreen}Gamedig Raw Output${default}"
208208
fn_messages_separator
209209
echo -e ""
210-
if [ ! "$(command -v gamedig 2> /dev/null)" ]; then
210+
if [ ! "$(command -v gamedig 2> /dev/null)" ] || [ ! -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
211211
fn_print_failure_nl "gamedig not installed"
212212
fi
213213
if [ ! "$(command -v jq 2> /dev/null)" ]; then

Diff for: lgsm/modules/command_install.sh

+3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ else
3030
install_server_files.sh
3131
fi
3232

33+
# Install gamedig
34+
check_gamedig.sh
35+
3336
# Configuration.
3437
install_config.sh
3538
if [ -v gslt ]; then

Diff for: lgsm/modules/command_monitor.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ fn_monitor_loop() {
369369
for querymethod in "${query_methods_array[@]}"; do
370370
# Will check if gamedig is installed and bypass if not.
371371
if [ "${querymethod}" == "gamedig" ]; then
372-
if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then
372+
if [ "$(command -v gamedig 2> /dev/null)" ] || [ -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ] && [ "$(command -v jq 2> /dev/null)" ]; then
373373
if [ -z "${monitorpass}" ]; then
374374
fn_monitor_query
375375
fi

Diff for: lgsm/modules/command_update_linuxgsm.sh

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn_firstcommand_set
1313
fn_print_dots ""
1414
check.sh
1515
info_distro.sh
16+
info_game.sh
1617

1718
fn_script_log_info "Updating LinuxGSM"
1819

Diff for: lgsm/modules/core_modules.sh

+5
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,11 @@ install_factorio_save.sh() {
714714
fn_fetch_module
715715
}
716716

717+
check_gamedig.sh() {
718+
modulefile="${FUNCNAME[0]}"
719+
fn_fetch_module
720+
}
721+
717722
install_dst_token.sh() {
718723
modulefile="${FUNCNAME[0]}"
719724
fn_fetch_module

Diff for: lgsm/modules/fix.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ fn_apply_fix() {
5252
fi
5353
}
5454

55-
apply_pre_start_fix=(arma3 armar ark av bt bo csgo cmw dst hw ins kf nmrih onset pvr rust rw samp sdtd sfc sof2 squad st tf2 terraria ts3 mcb mta unt vh wurm zmr)
55+
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)
5656
apply_post_install_fix=(av kf kf2 ro ut2k4 ut ut3)
5757

5858
# validate registered fixes for safe development

Diff for: lgsm/modules/fix_ro.sh

+106-28
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,115 @@
33
# Author: Daniel Gibbs
44
# Contributors: http://linuxgsm.com/contrib
55
# Website: https://linuxgsm.com
6-
# Description: Resolves issues with Red Orchestra.
6+
# Description: Resolves issues with Red Orchestra: Ostfront 41-45.
77

88
moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
99

10-
echo -e "applying webinterface ROOst.css fix."
11-
echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
10+
# echo -e "applying WebAdmin ROOst.css fix."
11+
# echo -e "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
1212
sed -i 's/none}/none;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
1313
sed -i 's/underline}/underline;/g' "${serverfiles}/Web/ServerAdmin/ROOst.css"
14-
fn_sleep_time
15-
echo -e "applying webinterface CharSet fix."
16-
echo -e "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
14+
# echo -e "applying WebAdmin CharSet fix."
15+
# echo -e "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
1716
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int"
18-
fn_sleep_time
19-
echo -e "applying Steam AppID fix."
20-
sed -i 's/1210/1200/g' "${systemdir}/steam_appid.txt"
21-
fn_sleep_time
22-
echo -e "applying server name fix."
23-
fn_sleep_time
24-
echo -e "forcing server restart..."
25-
fn_sleep_time
26-
exitbypass=1
27-
command_start.sh
28-
fn_firstcommand_reset
29-
fn_sleep_time_5
30-
exitbypass=1
31-
command_stop.sh
32-
fn_firstcommand_reset
33-
exitbypass=1
34-
command_start.sh
35-
fn_firstcommand_reset
36-
fn_sleep_time_5
37-
exitbypass=1
38-
command_stop.sh
39-
fn_firstcommand_reset
17+
18+
# get md5sum of steamclient.so
19+
if [ -f "${serverfiles}/system/steamclient.so" ]; then
20+
steamclientmd5=$(md5sum "${serverfiles}/system/steamclient.so" | awk '{print $1;}')
21+
fi
22+
#get md5sum of libtier0_s.so
23+
if [ -f "${serverfiles}/system/libtier0_s.so" ]; then
24+
libtier0_smd5=$(md5sum "${serverfiles}/system/libtier0_s.so" | awk '{print $1;}')
25+
fi
26+
#get md5sum of libvstdlib_s.so
27+
if [ -f "${serverfiles}/system/libvstdlib_s.so" ]; then
28+
libvstdlib_smd5=$(md5sum "${serverfiles}/system/libvstdlib_s.so" | awk '{print $1;}')
29+
fi
30+
31+
# get md5sum of steamclient.so from steamcmd
32+
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
33+
steamcmdsteamclientmd5=$(md5sum "${HOME}/.steam/steamcmd/linux32/steamclient.so" | awk '{print $1;}')
34+
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
35+
steamcmdsteamclientmd5=$(md5sum "${steamcmddir}/linux32/steamclient.so" | awk '{print $1;}')
36+
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" ]; then
37+
steamcmdsteamclientmd5=$(md5sum "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" | awk '{print $1;}')
38+
fi
39+
40+
# get md5sum of libtier0_s.so from steamcmd
41+
if [ -f "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" ]; then
42+
steamcmdlibtier0_smd5=$(md5sum "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" | awk '{print $1;}')
43+
elif [ -f "${steamcmddir}/linux32/libtier0_s.so" ]; then
44+
steamcmdlibtier0_smd5=$(md5sum "${steamcmddir}/linux32/libtier0_s.so" | awk '{print $1;}')
45+
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" ]; then
46+
steamcmdlibtier0_smd5=$(md5sum "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" | awk '{print $1;}')
47+
fi
48+
49+
# get md5sum of libvstdlib_s.so from steamcmd
50+
if [ -f "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" ]; then
51+
steamcmdlibvstdlib_smd5=$(md5sum "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" | awk '{print $1;}')
52+
elif [ -f "${steamcmddir}/linux32/libvstdlib_s.so" ]; then
53+
steamcmdlibvstdlib_smd5=$(md5sum "${steamcmddir}/linux32/libvstdlib_s.so" | awk '{print $1;}')
54+
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" ]; then
55+
steamcmdlibvstdlib_smd5=$(md5sum "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" | awk '{print $1;}')
56+
fi
57+
58+
if [ ! -f "${serverfiles}/system/steamclient.so" ] || [ "${steamcmdsteamclientmd5}" != "${steamclientmd5}" ]; then
59+
fixname="steamclient.so x86"
60+
fn_fix_msg_start
61+
if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
62+
cp "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/system/steamclient.so"
63+
elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
64+
cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/system/steamclient.so"
65+
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" ]; then
66+
cp "${HOME}/.local/share/Steam/steamcmd/linux32/steamclient.so" "${serverfiles}/system/steamclient.so"
67+
fi
68+
fn_fix_msg_end
69+
fi
70+
71+
if [ ! -f "${serverfiles}/system/libtier0_s.so" ] || [ "${steamcmdlibtier0_smd5}" != "${libtier0_smd5}" ]; then
72+
fixname="libtier0_s.so"
73+
fn_fix_msg_start
74+
if [ -f "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" ]; then
75+
cp "${HOME}/.steam/steamcmd/linux32/libtier0_s.so" "${serverfiles}/system/libtier0_s.so"
76+
elif [ -f "${steamcmddir}/linux32/libtier0_s.so" ]; then
77+
cp "${steamcmddir}/linux32/libtier0_s.so" "${serverfiles}/system/libtier0_s.so"
78+
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" ]; then
79+
cp "${HOME}/.local/share/Steam/steamcmd/linux32/libtier0_s.so" "${serverfiles}/system/libtier0_s.so"
80+
fi
81+
fn_fix_msg_end
82+
fi
83+
84+
if [ ! -f "${serverfiles}/system/libvstdlib_s.so" ] || [ "${steamcmdlibvstdlib_smd5}" != "${libvstdlib_smd5}" ]; then
85+
fixname="libvstdlib_s.so"
86+
fn_fix_msg_start
87+
if [ -f "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" ]; then
88+
cp "${HOME}/.steam/steamcmd/linux32/libvstdlib_s.so" "${serverfiles}/system/libvstdlib_s.so"
89+
elif [ -f "${steamcmddir}/linux32/libvstdlib_s.so" ]; then
90+
cp "${steamcmddir}/linux32/libvstdlib_s.so" "${serverfiles}/system/libvstdlib_s.so"
91+
elif [ -f "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" ]; then
92+
cp "${HOME}/.local/share/Steam/steamcmd/linux32/libvstdlib_s.so" "${serverfiles}/system/libvstdlib_s.so"
93+
fi
94+
fn_fix_msg_end
95+
fi
96+
97+
# if running install command
98+
if [ "${commandname}" == "INSTALL" ]; then
99+
echo -e "applying server name fix."
100+
fn_sleep_time
101+
echo -e "forcing server restart..."
102+
fn_sleep_time
103+
exitbypass=1
104+
command_start.sh
105+
fn_firstcommand_reset
106+
fn_sleep_time_5
107+
exitbypass=1
108+
command_stop.sh
109+
fn_firstcommand_reset
110+
exitbypass=1
111+
command_start.sh
112+
fn_firstcommand_reset
113+
fn_sleep_time_5
114+
exitbypass=1
115+
command_stop.sh
116+
fn_firstcommand_reset
117+
fi

Diff for: lgsm/modules/info_game.sh

+4
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ fn_info_game_pvr() {
621621
fn_info_game_pw() {
622622
servername="${servername:-"NOT SET"}"
623623
port="${port:-"0"}"
624+
queryport="${port:-"0"}"
624625
steamport="${steamport:-"0"}"
625626
unknownport="1985"
626627
}
@@ -1242,6 +1243,7 @@ fn_info_game_eco() {
12421243
fn_info_game_json "httpport" ".WebServerPort"
12431244
fn_info_game_json "maxplayers" ".MaxConnections"
12441245
fn_info_game_json "port" ".GameServerPort"
1246+
fn_info_game_json "rconport" ".RconServerPort"
12451247
fn_info_game_json "servername" ".Description"
12461248
fn_info_game_json "serverpassword" ".Password"
12471249
fn_info_game_json "tickrate" ".Rate"
@@ -1250,6 +1252,8 @@ fn_info_game_eco() {
12501252
httpport="${httpport:-"0"}"
12511253
maxplayers="${maxplayers:-"0"}"
12521254
port="${port:-"0"}"
1255+
queryport="${port:-"0"}"
1256+
rconport="${rconport:-"0"}"
12531257
servername="${servername:-"NOT SET"}"
12541258
serverpassword="${serverpassword:-"NOT SET"}"
12551259
tickrate="${tickrate:-"0"}"

Diff for: lgsm/modules/info_messages.sh

+4
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,8 @@ fn_info_messages_ports() {
692692
portcommand="ss -tuplwn | grep AvorionServer"
693693
elif [ "${shortname}" == "bf1942" ]; then
694694
portcommand="ss -tuplwn | grep bf1942_lnxded"
695+
elif [ "${shortname}" == "bfv" ]; then
696+
portcommand="ss -tuplwn | grep bfv_linded"
695697
elif [ "${shortname}" == "dayz" ]; then
696698
portcommand="ss -tuplwn | grep enfMain"
697699
elif [ "${shortname}" == "q4" ]; then
@@ -1015,7 +1017,9 @@ fn_info_messages_eco() {
10151017
{
10161018
fn_port "header"
10171019
fn_port "Game" port udp
1020+
fn_port "Query" queryport udp
10181021
fn_port "Web Interface" httpport tcp
1022+
fn_port "RCON" rconport tcp
10191023
} | column -s $'\t' -t
10201024
}
10211025

Diff for: lgsm/modules/query_gamedig.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
1010
# Default query status to failure. Will be changed to 0 if query is successful.
1111
querystatus="2"
1212
# Check if gamedig and jq are installed.
13-
if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then
13+
14+
if [ -f "${lgsmdir}/node_modules/gamedig/bin/gamedig.js" ]; then
15+
gamedigbinary="${lgsmdir}/node_modules/gamedig/bin/gamedig.js"
16+
else
17+
gamedigbinary="gamedig"
18+
fi
19+
20+
if [ "$(command -v "${gamedigbinary}" 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)" ]; then
1421

1522
# will bypass query if server offline.
1623
check_status.sh
@@ -20,8 +27,8 @@ if [ "$(command -v gamedig 2> /dev/null)" ] && [ "$(command -v jq 2> /dev/null)"
2027
queryport="${port}"
2128
fi
2229
# checks if query is working null = pass.
23-
gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" \"${queryip}:${queryport}\"|jq")
24-
gamedigraw=$(gamedig --type "${querytype}" "${queryip}:${queryport}")
30+
gamedigcmd=$(echo -e "${gamedigbinary} --type \"${querytype}\" \"${queryip}:${queryport}\"|jq")
31+
gamedigraw=$(${gamedigbinary} --type "${querytype}" "${queryip}:${queryport}")
2532
querystatus=$(echo "${gamedigraw}" | jq '.error|length')
2633

2734
if [ "${querytype}" == "teamspeak3" ]; then

0 commit comments

Comments
 (0)