Browse Source

feat(details): Add game server resource usage and details refactor (#2527)

* Add game server memory usage in details
* add network details
* added link speed
pull/2536/head
Daniel Gibbs 6 years ago
committed by GitHub
parent
commit
11336dc7dd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      lgsm/config-default/config-lgsm/ts3server/_default.cfg
  2. 4
      lgsm/functions/alert.sh
  3. 4
      lgsm/functions/command_details.sh
  4. 4
      lgsm/functions/command_postdetails.sh
  5. 23
      lgsm/functions/info_distro.sh
  6. 362
      lgsm/functions/info_messages.sh

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

@ -96,7 +96,7 @@ sleeptime="0.5"
# 8: 7 Days to Die # 8: 7 Days to Die
# 9: Gold Source # 9: Gold Source
# 10: Teamspeak 3 # 10: Teamspeak 3
stopmode="" stopmode="10"
## LinuxGSM Server Details ## LinuxGSM Server Details
# Do not edit # Do not edit

4
lgsm/functions/alert.sh

@ -18,8 +18,8 @@ fn_alert_log(){
{ {
fn_info_message_head fn_info_message_head
fn_info_message_distro fn_info_message_distro
fn_info_message_performance fn_info_message_server_resource
fn_info_message_disk fn_info_message_gameserver_resource
fn_info_message_gameserver fn_info_message_gameserver
fn_info_logs fn_info_logs
} | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${alertlog}" > /dev/null 2>&1 } | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g"| tee -a "${alertlog}" > /dev/null 2>&1

4
lgsm/functions/command_details.sh

@ -17,8 +17,8 @@ info_distro.sh
info_messages.sh info_messages.sh
query_gamedig.sh query_gamedig.sh
fn_info_message_distro fn_info_message_distro
fn_info_message_performance fn_info_message_server_resource
fn_info_message_disk fn_info_message_gameserver_resource
fn_info_message_gameserver fn_info_message_gameserver
fn_info_message_script fn_info_message_script
fn_info_message_backup fn_info_message_backup

4
lgsm/functions/command_postdetails.sh

@ -61,8 +61,8 @@ else
touch "${postdetailslog}" || fn_bad_postdetailslog touch "${postdetailslog}" || fn_bad_postdetailslog
{ {
fn_info_message_distro fn_info_message_distro
fn_info_message_performance fn_info_message_server_resource
fn_info_message_disk fn_info_message_gameserver_resource
fn_info_message_gameserver fn_info_message_gameserver
fn_info_message_script fn_info_message_script
fn_info_message_backup fn_info_message_backup

23
lgsm/functions/info_distro.sh

@ -7,6 +7,12 @@
local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" local function_selfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
### Game Server pid
if [ "${status}" == "1" ]; then
if [ "${shortname}" != "ts3" ]; then
gameserverpid=$(tmux list-sessions -F "#{session_name} #{pane_pid}"| grep "^${servicename}"|awk '{print $2}')
fi
fi
### Distro information ### Distro information
## Distro ## Distro
@ -92,7 +98,11 @@ load=$(uptime|awk -F 'load average: ' '{ print $2 }')
## CPU information ## CPU information
cpumodel=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//') cpumodel=$(awk -F: '/model name/ {name=$2} END {print name}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
cpucores=$(awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo) cpucores=$(awk -F: '/model name/ {core++} END {print core}' /proc/cpuinfo)
cpufreuency=$(awk -F: ' /cpu MHz/ {freq=$2} END {print freq " MHz"}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//') cpufreqency=$(awk -F: ' /cpu MHz/ {freq=$2} END {print freq " MHz"}' /proc/cpuinfo | sed 's/^[ \t]*//;s/[ \t]*$//')
# CPU usage of the game server pid
if [ "${status}" == "1" ]; then
cpuused=$(ps --forest -o pcpu -g "$(ps -o sid= -p "${gameserverpid}")"|awk '{s+=$1} END {print s}')
fi
## Memory information ## Memory information
# Available RAM and swap. # Available RAM and swap.
@ -126,6 +136,13 @@ if [ -n "$(command -v numfmt 2>/dev/null)" ]; then
swaptotal=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K") swaptotal=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapTotal /proc/meminfo | awk '{print $2}')K")
swapfree=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K") swapfree=$(numfmt --to=iec --from=iec --suffix=B "$(grep ^SwapFree /proc/meminfo | awk '{print $2}')K")
swapused=$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}')-$(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K") swapused=$(numfmt --to=iec --from=iec --suffix=B "$(($(grep ^SwapTotal /proc/meminfo | awk '{print $2}')-$(grep ^SwapFree /proc/meminfo | awk '{print $2}')))K")
# RAM usage of the game server pid
# MB
if [ "${status}" == "1" ]; then
memused=$(ps --forest -o rss -g "$(ps -o sid= -p "${gameserverpid}")"|awk '{s+=$1} END {print s}'| awk '{$1/=1024;printf "%.0fMB\t",$1}{print $2}')
# %
pmemused=$(ps --forest -o %mem -g "$(ps -o sid= -p 2766)"|awk '{s+=$1} END {print s}')
fi
else else
# Older distros will need to use free. # Older distros will need to use free.
# Older versions of free do not support -h option. # Older versions of free do not support -h option.
@ -206,6 +223,10 @@ if [ -d "${backupdir}" ]; then
fi fi
fi fi
# Network Interface name
netint=$(ip -o addr | grep "${ip}" | awk '{print $2}')
netlink=$(ethtool "${netint}" 2>/dev/null| grep Speed | awk '{print $2}')
# External IP address # External IP address
if [ -z "${extip}" ]; then if [ -z "${extip}" ]; then
extip=$(${curlpath} -4 -m 3 ifconfig.co 2>/dev/null) extip=$(${curlpath} -4 -m 3 ifconfig.co 2>/dev/null)

362
lgsm/functions/info_messages.sh

@ -46,85 +46,127 @@ fn_info_message_distro(){
echo -e "${lightyellow}Distro Details${default}" echo -e "${lightyellow}Distro Details${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}Distro:\t${default}${distroname}" echo -e "${lightblue}Distro:\t${default}${distroname}"
echo -e "${blue}Arch:\t${default}${arch}" echo -e "${lightblue}Arch:\t${default}${arch}"
echo -e "${blue}Kernel:\t${default}${kernel}" echo -e "${lightblue}Kernel:\t${default}${kernel}"
echo -e "${blue}Hostname:\t${default}${HOSTNAME}" echo -e "${lightblue}Hostname:\t${default}${HOSTNAME}"
echo -e "${blue}tmux:\t${default}${tmuxv}" echo -e "${lightblue}Uptime:\t${default}${days}d, ${hours}h, ${minutes}m"
echo -e "${blue}glibc:\t${default}${glibcversion}" echo -e "${lightblue}tmux:\t${default}${tmuxv}"
echo -e "${lightblue}glibc:\t${default}${glibcversion}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }
fn_info_message_performance(){ fn_info_message_server_resource(){
# #
# Performance # Server Resource
# ===================================== # ==========================================================================================================================================================================================================================================
# Uptime: 55d, 3h, 38m # CPU
# Avg Load: 1.00, 1.01, 0.78 # Model: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
# Cores: 4
# Frequency: 2499.994 MHz
# Avg Load: 0.20, 0.08, 0.01
#
# Memory
# Mem: total used free cached available
# Physical: 7.8GB 598MB 7.0GB 4.0GB 7.0GB
# Swap: 512MB 0B 512MB
# #
# Mem: total used free cached # Storage
# Physical: 741M 656M 85M 256M # Filesystem: /dev/sda
# Swap: 0B 0B 0B # Total: 157G
# Used: 138G
# Available: 12G
echo -e "" echo -e ""
echo -e "${lightyellow}Performance${default}" echo -e "${lightyellow}Server Resource${default}"
fn_messages_separator
{ {
echo -e "${blue}Uptime:\t${default}${days}d, ${hours}h, ${minutes}m" echo -e "${lightyellow}CPU\t${default}"
echo -e "${blue}Avg Load:\t${default}${load}" echo -e "${lightblue}Model:\t${default}${cpumodel}"
echo -e "${lightblue}Cores:\t${default}${cpucores}"
echo -e "${lightblue}Frequency:\t${default}${cpufreqency}"
echo -e "${lightblue}Avg Load:\t${default}${load}"
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
{ {
echo -e "${blue}CPU Model:\t${default}${cpumodel}" echo -e "${lightyellow}Memory\t${default}"
echo -e "${blue}CPU Cores:\t${default}${cpucores}" echo -e "${lightblue}Mem:\t${lightblue}total\tused\tfree\tcached\tavailable${default}"
echo -e "${blue}CPU Frequency:\t${default}${cpufreuency}" echo -e "${lightblue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}\t${physmemavailable}${default}"
echo -e "${lightblue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}"
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
{ {
echo -e "${blue}Mem:\t${blue}total\tused\tfree\tcached\tavailable${default}" echo -e "${lightyellow}Storage${default}"
echo -e "${blue}Physical:\t${default}${physmemtotal}\t${physmemused}\t${physmemfree}\t${physmemcached}\t${physmemavailable}${default}" echo -e "${lightblue}Filesystem:\t${default}${filesystem}"
echo -e "${blue}Swap:\t${default}${swaptotal}\t${swapused}\t${swapfree}${default}" echo -e "${lightblue}Total:\t\t${default}${totalspace}"
echo -e "${lightblue}Used:\t\t${default}${usedspace}"
echo -e "${lightblue}Available:\t${default}${availspace}"
} | column -s $'\t' -t
echo -e ""
{
echo -e "${lightyellow}Network${default}"
if [ "${netint}" ]; then
echo -e "${lightblue}Interface:\t${default}${netint}"
fi
if [ "${netlink}" ]; then
echo -e "${lightblue}Link Speed:\t${default}${netlink}"
fi
echo -e "${lightblue}IP:\t${default}${ip}"
if [ "${ip}" != "${extip}" ]; then
echo -e "${lightblue}Internet IP:\t${default}${extip}"
fi
} | column -s $'\t' -t } | column -s $'\t' -t
} }
fn_info_message_disk(){ fn_info_message_gameserver_resource(){
# Game Server Resource Usage
# ==========================================================================================================================================================================================================================================
# CPU Used: 2.5%
# Mem Used: 2.1% 171MB
# #
# Storage # Storage
# ===================================== # Total: 21G
# Filesystem: /dev/disk/by-uuid/320c8edd-a2ce-4a23-8c9d-e00a7af2d6ff # Serverfiles: 20G
# Total: 15G # Backups: 20K
# Used: 8.4G
# Available: 5.7G
# LinuxGSM Total: 1G
# Serverfiles: 961M
# Backups: 2G
echo -e "" echo -e ""
echo -e "${lightyellow}Storage${default}" echo -e "${lightyellow}Game Server Resource Usage${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}Filesystem:\t${default}${filesystem}" if [ "${status}" == "1" ]; then
echo -e "${blue}Total:\t${default}${totalspace}" echo -e "${lightblue}CPU Used:\t${default}${cpuused}%${default}"
echo -e "${blue}Used:\t${default}${usedspace}" echo -e "${lightblue}Mem Used:\t${default}${pmemused}%\t${memused}${default}"
echo -e "${blue}Available:\t${default}${availspace}" else
echo -e "${blue}LinuxGSM Total:\t${default}${rootdirdu}" echo -e "${lightblue}CPU Used:\t${default}0%${default}"
echo -e "${blue}Serverfiles:\t${default}${serverfilesdu}" echo -e "${lightblue}Mem Used:\t${default}0%\t0MB${default}"
fi
} | column -s $'\t' -t
echo -e ""
{
echo -e "${lightyellow}Storage${default}"
echo -e "${lightblue}Total:\t${default}${rootdirdu}"
echo -e "${lightblue}Serverfiles:\t${default}${serverfilesdu}"
if [ -d "${backupdir}" ]; then if [ -d "${backupdir}" ]; then
echo -e "${blue}Backups:\t${default}${backupdirdu}" echo -e "${lightblue}Backups:\t${default}${backupdirdu}"
fi fi
} | column -s $'\t' -t } | column -s $'\t' -t
} }
fn_info_message_gameserver(){ fn_info_message_gameserver(){
# # Counter-Strike: Global Offensive Server Details
# Quake Live Server Details # ==========================================================================================================================================================================================================================================
# ===================================== # Server name: LinuxGSM
# Server name: ql-server # Server IP: 80.70.189.230:27015
# Server IP: 1.2.3.4:27960
# RCON password: CHANGE_ME
# Server password: NOT SET # Server password: NOT SET
# Maxplayers: 16 # RCON password: adminF54CC0VR
# Status: OFFLINE # Players: 0/16
# Current Map: de_mirage
# Default Map: de_mirage
# Game type: 0
# Game mode: 0
# Tick rate: 64
# Master Server: true
# Status: ONLINE
echo -e "" echo -e ""
echo -e "${lightgreen}${gamename} Server Details${default}" echo -e "${lightgreen}${gamename} Server Details${default}"
@ -133,215 +175,215 @@ fn_info_message_gameserver(){
{ {
# Server name # Server name
if [ -n "${gdname}" ]; then if [ -n "${gdname}" ]; then
echo -e "${blue}Server name:\t${default}${gdname}" echo -e "${lightblue}Server name:\t${default}${gdname}"
elif [ -n "${servername}" ]; then elif [ -n "${servername}" ]; then
echo -e "${blue}Server name:\t${default}${servername}" echo -e "${lightblue}Server name:\t${default}${servername}"
fi fi
# Server description # Server description
if [ -n "${serverdescription}" ]; then if [ -n "${serverdescription}" ]; then
echo -e "${blue}Server Description:\t${default}${serverdescription}" echo -e "${lightblue}Server Description:\t${default}${serverdescription}"
fi fi
# Branch # Branch
if [ -n "${branch}" ]; then if [ -n "${branch}" ]; then
echo -e "${blue}Branch:\t${default}${branch}" echo -e "${lightblue}Branch:\t${default}${branch}"
fi fi
# Server ip # Server ip
if [ "${multiple_ip}" == "1" ]; then if [ "${multiple_ip}" == "1" ]; then
echo -e "${blue}Server IP:\t${default}NOT SET" echo -e "${lightblue}Server IP:\t${default}NOT SET"
else else
echo -e "${blue}Server IP:\t${default}${ip}:${port}" echo -e "${lightblue}Server IP:\t${default}${ip}:${port}"
fi fi
# Internet ip # Internet ip
if [ -n "${extip}" ]; then if [ -n "${extip}" ]; then
if [ "${ip}" != "${extip}" ]; then if [ "${ip}" != "${extip}" ]; then
echo -e "${blue}Internet IP:\t${default}${extip}:${port}" echo -e "${lightblue}Internet IP:\t${default}${extip}:${port}"
fi fi
fi fi
# Display ip # Display ip
if [ -n "${displayip}" ]; then if [ -n "${displayip}" ]; then
echo -e "${blue}Display IP:\t${default}${displayip}:${port}" echo -e "${lightblue}Display IP:\t${default}${displayip}:${port}"
fi fi
# Server password # Server password
if [ -n "${serverpassword}" ]; then if [ -n "${serverpassword}" ]; then
echo -e "${blue}Server password:\t${default}${serverpassword}" echo -e "${lightblue}Server password:\t${default}${serverpassword}"
fi fi
# Query enabled (Starbound) # Query enabled (Starbound)
if [ -n "${queryenabled}" ]; then if [ -n "${queryenabled}" ]; then
echo -e "${blue}Query enabled:\t${default}${queryenabled}" echo -e "${lightblue}Query enabled:\t${default}${queryenabled}"
fi fi
# RCON enabled (Starbound) # RCON enabled (Starbound)
if [ -n "${rconenabled}" ]; then if [ -n "${rconenabled}" ]; then
echo -e "${blue}RCON enabled:\t${default}${rconpassword}" echo -e "${lightblue}RCON enabled:\t${default}${rconpassword}"
fi fi
# RCON password # RCON password
if [ -n "${rconpassword}" ]; then if [ -n "${rconpassword}" ]; then
echo -e "${blue}RCON password:\t${default}${rconpassword}" echo -e "${lightblue}RCON password:\t${default}${rconpassword}"
fi fi
# RCON web (Rust) # RCON web (Rust)
if [ -n "${rconweb}" ]; then if [ -n "${rconweb}" ]; then
echo -e "${blue}RCON web:\t${default}${rconweb}" echo -e "${lightblue}RCON web:\t${default}${rconweb}"
fi fi
# Admin password # Admin password
if [ -n "${adminpassword}" ]; then if [ -n "${adminpassword}" ]; then
echo -e "${blue}Admin password:\t${default}${adminpassword}" echo -e "${lightblue}Admin password:\t${default}${adminpassword}"
fi fi
# Stats password (Quake Live) # Stats password (Quake Live)
if [ -n "${statspassword}" ]; then if [ -n "${statspassword}" ]; then
echo -e "${blue}Stats password:\t${default}${statspassword}" echo -e "${lightblue}Stats password:\t${default}${statspassword}"
fi fi
# Players # Players
if [ "${querystatus}" != "0" ]; then if [ "${querystatus}" != "0" ]; then
if [ -n "${maxplayers}" ]; then if [ -n "${maxplayers}" ]; then
echo -e "${blue}Maxplayers:\t${default}${maxplayers}" echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
fi fi
else else
if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then if [ -n "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
echo -e "${blue}Players:\t${default}${gdplayers}/${gdmaxplayers}" echo -e "${lightblue}Players:\t${default}${gdplayers}/${gdmaxplayers}"
elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then elif [ -n "${gdplayers}" ]&&[ -n "${maxplayers}" ]; then
echo -e "${blue}Players:\t${default}${gdplayers}/${maxplayers}" echo -e "${lightblue}Players:\t${default}${gdplayers}/${maxplayers}"
elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then elif [ -z "${gdplayers}" ]&&[ -n "${gdmaxplayers}" ]; then
echo -e "${blue}Players:\t${default}0/${gdmaxplayers}" echo -e "${lightblue}Players:\t${default}0/${gdmaxplayers}"
elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then elif [ -n "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]; then
echo -e "${blue}Players:\t${default}${gdplayers}|∞" echo -e "${lightblue}Players:\t${default}${gdplayers}|∞"
elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then elif [ -z "${gdplayers}" ]&&[ -z "${gdmaxplayers}" ]&&[ -n "${maxplayers}" ]; then
echo -e "${blue}Maxplayers:\t${default}${maxplayers}" echo -e "${lightblue}Maxplayers:\t${default}${maxplayers}"
fi fi
fi fi
# Bots # Bots
if [ -n "${gdbots}" ]; then if [ -n "${gdbots}" ]; then
echo -e "${blue}Bots:\t${default}${gdbots}" echo -e "${lightblue}Bots:\t${default}${gdbots}"
fi fi
# Current Map # Current Map
if [ -n "${gdmap}" ]; then if [ -n "${gdmap}" ]; then
echo -e "${blue}Current Map:\t${default}${gdmap}" echo -e "${lightblue}Current Map:\t${default}${gdmap}"
fi fi
if [ -n "${defaultscenario}" ]; then if [ -n "${defaultscenario}" ]; then
# Current Scenario # Current Scenario
if [ -n "${gdgamemode}" ]; then if [ -n "${gdgamemode}" ]; then
echo -e "${blue}Current Scenario:\t${default}${gdgamemode}" echo -e "${lightblue}Current Scenario:\t${default}${gdgamemode}"
fi fi
else else
# Current Scenario # Current Scenario
if [ -n "${gdgamemode}" ]; then if [ -n "${gdgamemode}" ]; then
echo -e "${blue}Current Game Mode:\t${default}${gdgamemode}" echo -e "${lightblue}Current Game Mode:\t${default}${gdgamemode}"
fi fi
fi fi
# Default Map # Default Map
if [ -n "${defaultmap}" ]; then if [ -n "${defaultmap}" ]; then
echo -e "${blue}Default Map:\t${default}${defaultmap}" echo -e "${lightblue}Default Map:\t${default}${defaultmap}"
fi fi
# Default Scenario # Default Scenario
if [ -n "${defaultscenario}" ]; then if [ -n "${defaultscenario}" ]; then
echo -e "${blue}Default Scenario:\t${default}${defaultscenario}" echo -e "${lightblue}Default Scenario:\t${default}${defaultscenario}"
fi fi
# Game type # Game type
if [ -n "${gametype}" ]; then if [ -n "${gametype}" ]; then
echo -e "${blue}Game type:\t${default}${gametype}" echo -e "${lightblue}Game type:\t${default}${gametype}"
fi fi
# Game mode # Game mode
if [ -n "${gamemode}" ]; then if [ -n "${gamemode}" ]; then
echo -e "${blue}Game mode:\t${default}${gamemode}" echo -e "${lightblue}Game mode:\t${default}${gamemode}"
fi fi
# Game world # Game world
if [ -n "${gameworld}" ]; then if [ -n "${gameworld}" ]; then
echo -e "${blue}Game world:\t${default}${gameworld}" echo -e "${lightblue}Game world:\t${default}${gameworld}"
fi fi
# Tick rate # Tick rate
if [ -n "${tickrate}" ]; then if [ -n "${tickrate}" ]; then
echo -e "${blue}Tick rate:\t${default}${tickrate}" echo -e "${lightblue}Tick rate:\t${default}${tickrate}"
fi fi
# Sharding (Don't Starve Together) # Sharding (Don't Starve Together)
if [ -n "${sharding}" ]; then if [ -n "${sharding}" ]; then
echo -e "${blue}Sharding:\t${default}${sharding}" echo -e "${lightblue}Sharding:\t${default}${sharding}"
fi fi
# Master (Don't Starve Together) # Master (Don't Starve Together)
if [ -n "${master}" ]; then if [ -n "${master}" ]; then
echo -e "${blue}Master:\t${default}${master}" echo -e "${lightblue}Master:\t${default}${master}"
fi fi
# Shard (Don't Starve Together) # Shard (Don't Starve Together)
if [ -n "${shard}" ]; then if [ -n "${shard}" ]; then
echo -e "${blue}Shard:\t${default}${shard}" echo -e "${lightblue}Shard:\t${default}${shard}"
fi fi
# Cluster (Don't Starve Together) # Cluster (Don't Starve Together)
if [ -n "${cluster}" ]; then if [ -n "${cluster}" ]; then
echo -e "${blue}Cluster:\t${default}${cluster}" echo -e "${lightblue}Cluster:\t${default}${cluster}"
fi fi
# Cave (Don't Starve Together) # Cave (Don't Starve Together)
if [ -n "${cave}" ]; then if [ -n "${cave}" ]; then
echo -e "${blue}Cave:\t${default}${cave}" echo -e "${lightblue}Cave:\t${default}${cave}"
fi fi
# Creativemode (Hurtworld) # Creativemode (Hurtworld)
if [ -n "${creativemode}" ]; then if [ -n "${creativemode}" ]; then
echo -e "${blue}Creativemode:\t${default}${creativemode}" echo -e "${lightblue}Creativemode:\t${default}${creativemode}"
fi fi
# TeamSpeak dbplugin # TeamSpeak dbplugin
if [ -n "${dbplugin}" ]; then if [ -n "${dbplugin}" ]; then
echo -e "${blue}dbplugin:\t${default}${dbplugin}" echo -e "${lightblue}dbplugin:\t${default}${dbplugin}"
fi fi
# ASE (Multi Theft Auto) # ASE (Multi Theft Auto)
if [ -n "${ase}" ]; then if [ -n "${ase}" ]; then
echo -e "${blue}ASE:\t${default}${ase}" echo -e "${lightblue}ASE:\t${default}${ase}"
fi fi
# Save interval (Rust) # Save interval (Rust)
if [ -n "${saveinterval}" ]; then if [ -n "${saveinterval}" ]; then
echo -e "${blue}ASE:\t${default}${saveinterval} s" echo -e "${lightblue}ASE:\t${default}${saveinterval} s"
fi fi
# Random map rotation mode (Squad and Post Scriptum) # Random map rotation mode (Squad and Post Scriptum)
if [ -n "${randommap}" ]; then if [ -n "${randommap}" ]; then
echo -e "${blue}Map rotation:\t${default}${randommap}" echo -e "${lightblue}Map rotation:\t${default}${randommap}"
fi fi
# Listed on Master Server # Listed on Master Server
if [ "${displaymasterserver}" ];then if [ "${displaymasterserver}" ];then
if [ "${displaymasterserver}" == "true" ];then if [ "${displaymasterserver}" == "true" ];then
echo -e "${blue}Master Server:\t${green}${displaymasterserver}${default}" echo -e "${lightblue}Master Server:\t${green}${displaymasterserver}${default}"
else else
echo -e "${blue}Master Server:\t${red}${displaymasterserver}${default}" echo -e "${lightblue}Master Server:\t${red}${displaymasterserver}${default}"
fi fi
fi fi
# Online status # Online status
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
echo -e "${blue}Status:\t${red}OFFLINE${default}" echo -e "${lightblue}Status:\t${red}OFFLINE${default}"
else else
echo -e "${blue}Status:\t${green}ONLINE${default}" echo -e "${lightblue}Status:\t${green}ONLINE${default}"
fi fi
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
@ -349,80 +391,88 @@ fn_info_message_gameserver(){
fn_info_message_script(){ fn_info_message_script(){
# #
# qlserver Script Details # csgoserver Script Details
# ===================================== #==========================================================================================================================================================================================================================================
# Service name: ql-server # Script name: csgoserver
# qlserver version: 150316 # LinuxGSM version: v19.9.0
# User: lgsm # glibc required: 2.15
# Email alert: off # Discord alert: off
# Update on start: off # Email alert: off
# Location: /home/lgsm/qlserver # Pushbullet alert: off
# Config file: /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg # IFTTT alert: off
# Mailgun (email) alert: off
# Pushover alert: off
# Telegram alert: off
# Update on start: off
# User: lgsm
# Location: /home/lgsm/csgoserver
# Config file: /home/lgsm/csgoserver/serverfiles/csgo/cfg/csgoserver.cfg
echo -e "${lightgreen}${selfname} Script Details${default}" echo -e "${lightgreen}${selfname} Script Details${default}"
fn_messages_separator fn_messages_separator
{ {
# Service name # Script name
echo -e "${blue}Service name:\t${default}${servicename}" echo -e "${lightblue}Script name:\t${default}${servicename}"
# Script version # LinuxGSM version
if [ -n "${version}" ]; then if [ -n "${version}" ]; then
echo -e "${blue}${selfname} version:\t${default}${version}" echo -e "${lightblue}LinuxGSM version:\t${default}${version}"
fi fi
# User
echo -e "${blue}User:\t${default}$(whoami)"
# glibc required # glibc required
if [ -n "${glibc}" ]; then if [ -n "${glibc}" ]; then
if [ "${glibc}" == "null" ]; then if [ "${glibc}" == "null" ]; then
# Glibc is not required. # Glibc is not required.
: :
elif [ -z "${glibc}" ]; then elif [ -z "${glibc}" ]; then
echo -e "${blue}glibc required:\t${red}UNKNOWN${default}" echo -e "${lightblue}glibc required:\t${red}UNKNOWN${default}"
elif [ "$(printf '%s\n'${glibc}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibc}" ]; then elif [ "$(printf '%s\n'${glibc}'\n' ${glibcversion} | sort -V | head -n 1)" != "${glibc}" ]; then
echo -e "${blue}glibc required:\t${red}${glibc} ${default}(${red}distro glibc ${glibcversion} too old${default})" echo -e "${lightblue}glibc required:\t${red}${glibc} ${default}(${red}distro glibc ${glibcversion} too old${default})"
else else
echo -e "${blue}glibc required:\t${green}${glibc}${default}" echo -e "${lightblue}glibc required:\t${green}${glibc}${default}"
fi fi
fi fi
# Discord alert # Discord alert
echo -e "${blue}Discord alert:\t${default}${discordalert}" echo -e "${lightblue}Discord alert:\t${default}${discordalert}"
# Email alert # Email alert
echo -e "${blue}Email alert:\t${default}${emailalert}" echo -e "${lightblue}Email alert:\t${default}${emailalert}"
# Pushbullet alert # Pushbullet alert
echo -e "${blue}Pushbullet alert:\t${default}${pushbulletalert}" echo -e "${lightblue}Pushbullet alert:\t${default}${pushbulletalert}"
# IFTTT alert # IFTTT alert
echo -e "${blue}IFTTT alert:\t${default}${iftttalert}" echo -e "${lightblue}IFTTT alert:\t${default}${iftttalert}"
# Mailgun alert # Mailgun alert
echo -e "${blue}Mailgun (email) alert:\t${default}${mailgunalert}" echo -e "${lightblue}Mailgun (email) alert:\t${default}${mailgunalert}"
# Pushover alert # Pushover alert
echo -e "${blue}Pushover alert:\t${default}${pushoveralert}" echo -e "${lightblue}Pushover alert:\t${default}${pushoveralert}"
# Telegram alert # Telegram alert
echo -e "${blue}Telegram alert:\t${default}${telegramalert}" echo -e "${lightblue}Telegram alert:\t${default}${telegramalert}"
# Update on start # Update on start
if [ -n "${updateonstart}" ]; then if [ -n "${updateonstart}" ]; then
echo -e "${blue}Update on start:\t${default}${updateonstart}" echo -e "${lightblue}Update on start:\t${default}${updateonstart}"
fi fi
# User
echo -e "${lightblue}User:\t${default}$(whoami)"
# Script location # Script location
echo -e "${blue}Location:\t${default}${rootdir}" echo -e "${lightblue}Location:\t${default}${rootdir}"
# Config file location # Config file location
if [ -n "${servercfgfullpath}" ]; then if [ -n "${servercfgfullpath}" ]; then
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
echo -e "${blue}Config file:\t${default}${servercfgfullpath}" echo -e "${lightblue}Config file:\t${default}${servercfgfullpath}"
elif [ -d "${servercfgfullpath}" ]; then elif [ -d "${servercfgfullpath}" ]; then
echo -e "${blue}Config dir:\t${default}${servercfgfullpath}" echo -e "${lightblue}Config dir:\t${default}${servercfgfullpath}"
else else
echo -e "${blue}Config file:\t${default}${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})" echo -e "${lightblue}Config file:\t${default}${red}${servercfgfullpath}${default} (${red}FILE MISSING${default})"
fi fi
fi fi
# Network config file location (ARMA 3) # Network config file location (ARMA 3)
if [ -n "${networkcfgfullpath}" ]; then if [ -n "${networkcfgfullpath}" ]; then
echo -e "${blue}Network config file:\t${default}${networkcfgfullpath}" echo -e "${lightblue}Network config file:\t${default}${networkcfgfullpath}"
fi fi
} | column -s $'\t' -t } | column -s $'\t' -t
} }
@ -444,17 +494,17 @@ fn_info_message_backup(){
echo -e "No Backups created" echo -e "No Backups created"
else else
{ {
echo -e "${blue}No. of backups:\t${default}${backupcount}" echo -e "${lightblue}No. of backups:\t${default}${backupcount}"
echo -e "${blue}Latest backup:${default}" echo -e "${lightblue}Latest backup:${default}"
if [ "${lastbackupdaysago}" == "0" ]; then if [ "${lastbackupdaysago}" == "0" ]; then
echo -e "${blue} date:\t${default}${lastbackupdate} (less than 1 day ago)" echo -e "${lightblue} date:\t${default}${lastbackupdate} (less than 1 day ago)"
elif [ "${lastbackupdaysago}" == "1" ]; then elif [ "${lastbackupdaysago}" == "1" ]; then
echo -e "${blue} date:\t${default}${lastbackupdate} (1 day ago)" echo -e "${lightblue} date:\t${default}${lastbackupdate} (1 day ago)"
else else
echo -e "${blue} date:\t${default}${lastbackupdate} (${lastbackupdaysago} days ago)" echo -e "${lightblue} date:\t${default}${lastbackupdate} (${lastbackupdaysago} days ago)"
fi fi
echo -e "${blue} file:\t${default}${lastbackup}" echo -e "${lightblue} file:\t${default}${lastbackup}"
echo -e "${blue} size:\t${default}${lastbackupsize}" echo -e "${lightblue} size:\t${default}${lastbackupsize}"
} | column -s $'\t' -t } | column -s $'\t' -t
fi fi
} }
@ -516,9 +566,9 @@ fn_info_message_ports(){
fn_info_message_statusbottom(){ fn_info_message_statusbottom(){
echo -e "" echo -e ""
if [ "${status}" == "0" ]; then if [ "${status}" == "0" ]; then
echo -e "${blue}Status:\t${red}OFFLINE${default}" echo -e "${lightblue}Status:\t${red}OFFLINE${default}"
else else
echo -e "${blue}Status:\t${green}ONLINE${default}" echo -e "${lightblue}Status:\t${green}ONLINE${default}"
fi fi
echo -e "" echo -e ""
} }
@ -934,17 +984,17 @@ fn_info_message_sdtd(){
echo -e "${lightgreen}${servername} WebAdmin${default}" echo -e "${lightgreen}${servername} WebAdmin${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}" echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}" echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
echo -e "${blue}WebAdmin password:\t${default}${webadminpass}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
} | column -s $'\t' -t } | column -s $'\t' -t
echo -e "" echo -e ""
echo -e "${lightgreen}${servername} Telnet${default}" echo -e "${lightgreen}${servername} Telnet${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}Telnet enabled:\t${default}${telnetenabled}" echo -e "${lightblue}Telnet enabled:\t${default}${telnetenabled}"
echo -e "${blue}Telnet address:\t${default}${ip} ${telnetport}" echo -e "${lightblue}Telnet address:\t${default}${ip} ${telnetport}"
echo -e "${blue}Telnet password:\t${default}${telnetpass}" echo -e "${lightblue}Telnet password:\t${default}${telnetpass}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }
@ -982,9 +1032,9 @@ fn_info_message_spark(){
echo -e "${lightgreen}${servername} WebAdmin${default}" echo -e "${lightgreen}${servername} WebAdmin${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html" echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}/index.html"
echo -e "${blue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
echo -e "${blue}WebAdmin password:\t${default}${webadminpass}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }
@ -1095,10 +1145,10 @@ fn_info_message_unreal(){
echo -e "${lightgreen}${servername} WebAdmin${default}" echo -e "${lightgreen}${servername} WebAdmin${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}" echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}" echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
echo -e "${blue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
echo -e "${blue}WebAdmin password:\t${default}${webadminpass}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }
@ -1115,10 +1165,10 @@ fn_info_message_unreal3(){
echo -e "${lightgreen}${servername} WebAdmin${default}" echo -e "${lightgreen}${servername} WebAdmin${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}" echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}" echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
echo -e "${blue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
echo -e "${blue}WebAdmin password:\t${default}${webadminpass}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }
@ -1146,10 +1196,10 @@ fn_info_message_kf2(){
echo -e "${lightgreen}${servername} WebAdmin${default}" echo -e "${lightgreen}${servername} WebAdmin${default}"
fn_messages_separator fn_messages_separator
{ {
echo -e "${blue}WebAdmin enabled:\t${default}${webadminenabled}" echo -e "${lightblue}WebAdmin enabled:\t${default}${webadminenabled}"
echo -e "${blue}WebAdmin url:\t${default}http://${ip}:${webadminport}" echo -e "${lightblue}WebAdmin url:\t${default}http://${ip}:${webadminport}"
echo -e "${blue}WebAdmin username:\t${default}${webadminuser}" echo -e "${lightblue}WebAdmin username:\t${default}${webadminuser}"
echo -e "${blue}WebAdmin password:\t${default}${webadminpass}" echo -e "${lightblue}WebAdmin password:\t${default}${webadminpass}"
} | column -s $'\t' -t } | column -s $'\t' -t
} }

Loading…
Cancel
Save