Browse Source

more accurate details on telnet IP address

telnetip
pull/3041/head
Daniel Gibbs 5 years ago
parent
commit
424b8300ec
  1. 4
      lgsm/functions/check_ip.sh
  2. 7
      lgsm/functions/info_config.sh
  3. 2
      lgsm/functions/info_messages.sh

4
lgsm/functions/check_ip.sh

@ -24,20 +24,24 @@ getipwc=$(${ipcommand} -o -4 addr | awk '{print $4}' | grep -oe '\([0-9]\{1,3\}\
if [ -n "${ip}" ]&&[ "${ip}" != "0.0.0.0" ]; then
queryips=( "${ip}" )
webadminip=( "${ip}" )
telnetip=( "${ip}" )
# If game config does have an IP set.
elif [ -n "${configip}" ]&&[ "${configip}" != "0.0.0.0" ];then
queryips=( "${configip}" )
ip="${configip}"
webadminip=( "${configip}" )
telnetip=( "${configip}" )
# If there is only 1 server IP address.
# Some IP details can automaticly use the one IP
elif [ "${getipwc}" == "1" ]; then
queryips=( $(echo "${getip}") )
ip="0.0.0.0"
webadminip=( "${getip}" )
telnetip=( "${getip}" )
# If no ip is set by the user and server has more than one IP.
else
queryips=( $(echo "${getip}") )
ip="0.0.0.0"
webadminip=( "${ip}" )
telnetip=( "${ip}" )
fi

7
lgsm/functions/info_config.sh

@ -1231,6 +1231,7 @@ fn_info_config_sdtd(){
telnetenabled="${unavailable}"
telnetport="${zero}"
telnetpass="${unavailable}"
telnetip="${unavailable}"
maxplayers="${unavailable}"
gamemode="${unavailable}"
gameworld="${unavailable}"
@ -1246,7 +1247,11 @@ fn_info_config_sdtd(){
telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
telnetpass=$(grep "TelnetPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
# Telnet IP will be localhost if no password is set
# check_ip will set the IP first. This will overwrite it.
if [ -z "${telnetpass}" ]; then
telnetip="127.0.0.1"
fi
maxplayers=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd '[:digit:]')
gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")

2
lgsm/functions/info_messages.sh

@ -1123,7 +1123,7 @@ fn_info_message_sdtd(){
fn_messages_separator
{
echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
echo -e "${lightblue}Telnet address:\t${default}${ip} ${telnetport}"
echo -e "${lightblue}Telnet address:\t${default}${telnetip} ${telnetport}"
echo -e "${lightblue}Telnet password:\t${default}${telnetpass}"
} | column -s $'\t' -t
}

Loading…
Cancel
Save