Browse Source

minor tweaks

pull/4206/head
Daniel Gibbs 2 years ago
parent
commit
a64c088419
  1. 10
      lgsm/modules/check_ip.sh
  2. 2
      lgsm/modules/command_dev_query_raw.sh

10
lgsm/modules/check_ip.sh

@ -10,7 +10,7 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
info_game.sh info_game.sh
ip_commands_array=("/bin/ip" "/usr/sbin/ip" "ip") ip_commands_array=("ip" "/bin/ip" "/usr/sbin/ip")
for ip_command in "${ip_commands_array[@]}"; do for ip_command in "${ip_commands_array[@]}"; do
if [ "$(command -v "${ip_command}" 2> /dev/null)" ]; then if [ "$(command -v "${ip_command}" 2> /dev/null)" ]; then
ipcommand="${ip_command}" ipcommand="${ip_command}"
@ -18,7 +18,7 @@ for ip_command in "${ip_commands_array[@]}"; do
fi fi
done done
ethtool_commands_array=("/bin/ethtool" "/usr/sbin/ethtool" "ethtool") ethtool_commands_array=("ethtool" "/bin/ethtool" "/usr/sbin/ethtool")
for ethtool_command in "${ethtool_commands_array[@]}"; do for ethtool_command in "${ethtool_commands_array[@]}"; do
if [ "$(command -v "${ethtool_command}" 2> /dev/null)" ]; then if [ "$(command -v "${ethtool_command}" 2> /dev/null)" ]; then
ethtoolcommand="${ethtool_command}" ethtoolcommand="${ethtool_command}"
@ -34,21 +34,21 @@ function fn_is_valid_ip() {
grep -qEe '^[1-9]+[0-9]*\.[0-9]+\.[0-9]+\.[0-9]+$' <<< "${ip}" grep -qEe '^[1-9]+[0-9]*\.[0-9]+\.[0-9]+\.[0-9]+$' <<< "${ip}"
} }
# Check if server has multiple IP addresses # Check if server has multiple IP addresses.
# If the IP variable has been set by user. # If the IP variable has been set by user.
if fn_is_valid_ip "${ip}"; then if fn_is_valid_ip "${ip}"; then
queryips=("${ip}") queryips=("${ip}")
httpip=("${ip}") httpip=("${ip}")
telnetip=("${ip}") telnetip=("${ip}")
# If game config does have an IP set. # If the game config has an IP set.
elif fn_is_valid_ip "${configip}"; then elif fn_is_valid_ip "${configip}"; then
queryips=("${configip}") queryips=("${configip}")
ip="${configip}" ip="${configip}"
httpip=("${configip}") httpip=("${configip}")
telnetip=("${configip}") telnetip=("${configip}")
# If there is only 1 server IP address. # If there is only 1 server IP address.
# Some IP details can automaticly use the one IP # Some IP details can automatically use the one IP.
elif [ "${#current_ips[@]}" == "1" ]; then elif [ "${#current_ips[@]}" == "1" ]; then
queryips=("127.0.0.1" "${current_ips[@]}") queryips=("127.0.0.1" "${current_ips[@]}")
ip="0.0.0.0" ip="0.0.0.0"

2
lgsm/modules/command_dev_query_raw.sh

@ -77,7 +77,7 @@ echo -e "=================================================================="
fi fi
if [ -v httpqueryport ]; then if [ -v httpqueryport ]; then
echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl | grep -c "${httpqueryport}") \t$(ss -tupl | grep" ${httpqueryport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep ${httpqueryport} | grep udp | awk '{ print $2 }')" echo -e "HTTP Query: \t${httpqueryport} \t$(ss -tupl | grep -c "${httpqueryport}") \t$(ss -tupl | grep" ${httpqueryport}" | grep tcp | awk '{ print $2 }') \t$(ss -tupl | grep "${httpqueryport}" | grep udp | awk '{ print $2 }')"
else else
echo -e "HTTP Query:" echo -e "HTTP Query:"
fi fi

Loading…
Cancel
Save