@ -7,12 +7,57 @@
functionselfname = " $( basename " $( readlink -f " ${ BASH_SOURCE [0] } " ) " ) "
# Standard Details
# This applies to all engines
# Separator is different for details
fn_messages_separator( ) {
if [ " ${ commandname } " = = "DETAILS" ] ; then
printf '%*s\n' " ${ COLUMNS :- $( tput cols) } " '' | tr ' ' =
else
echo -e "================================="
fi
}
# Removes the passwords form all but details.
fn_info_message_password_strip( ) {
if [ " ${ commandname } " != "DETAILS" ] ; then
if [ " ${ serverpassword } " ] ; then
serverpassword = "********"
fi
if [ " ${ rconpassword } " ] ; then
rconpassword = "********"
fi
if [ " ${ adminpassword } " ] ; then
adminpassword = "********"
fi
if [ " ${ statspassword } " ] ; then
statspassword = "********"
fi
if [ " ${ webadminpass } " ] ; then
webadminpass = "********"
fi
if [ " ${ telnetpass } " ] ; then
telnetpass = "********"
fi
if [ " ${ wsapikey } " ] ; then
wsapikey = "********"
fi
if [ " ${ gslt } " ] ; then
gslt = "********"
fi
fi
}
# Alert Summary
# used with alertlog
fn_info_message_head( ) {
echo -e ""
echo -e " ${ lightyellow } Summary ${ default } "
echo -e " ${ lightyellow } Alert Summary${ default } "
fn_messages_separator
echo -e "Message"
echo -e " ${ alertbody } "
@ -27,28 +72,27 @@ fn_info_message_head(){
echo -e " ${ HOSTNAME } "
echo -e ""
echo -e "Server IP"
if [ " ${ multiple_ip } " = = "1" ] ; then
echo -e "NOT SET"
else
echo -e " ${ ip } : ${ port } "
fi
echo -e " ${ ip } : ${ port } "
}
fn_info_message_distro( ) {
#
# Distro Details
# =====================================
# Distro: Ubuntu 14.04.4 LTS
# =================================
# Date: Sun 21 Feb 2021 09:22:53 AM UTC
# Distro: Ubuntu 20.04.2 LTS
# Arch: x86_64
# Kernel: 3.13.0-79-generic
# Hostname: hostname
# tmux: tmux 1.8
# glibc: 2.19
# Kernel: 5.4.0-65-generic
# Hostname: server
# Uptime: 16d, 5h, 18m
# tmux: tmux 3.0a
# glibc: 2.31
echo -e ""
echo -e " ${ lightyellow } Distro Details ${ default } "
fn_messages_separator
{
echo -e " ${ lightblue } Date:\t ${ default } ${ date } "
echo -e " ${ lightblue } Distro:\t ${ default } ${ distroname } "
echo -e " ${ lightblue } Arch:\t ${ default } ${ arch } "
echo -e " ${ lightblue } Kernel:\t ${ default } ${ kernel } "
@ -62,23 +106,27 @@ fn_info_message_distro(){
fn_info_message_server_resource( ) {
#
# Server Resource
# ==========================================================================================================================================================================================================================================
# =================================
# CPU
# 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
# Model: AMD EPYC 7601 32-Core Processor
# Cores: 2
# Frequency: 2199.994 MHz
# Avg Load: 0.01, 0.05, 0.18
#
# Memory
# Mem: total used free cached available
# Physical: 7.8GB 598MB 7.0GB 4.0GB 7.0 GB
# Swap: 512MB 0B 512 MB
# Physical: 3.9GB 350MB 3.3GB 3.2GB 3.3 GB
# Swap: 512MB 55MB 458 MB
#
# Storage
# Filesystem: /dev/sda
# Total: 157G
# Used: 138G
# Available: 12G
# Filesystem: /dev/sda
# Total: 79G
# Used: 73G
# Available: 1.4G
#
# Network
# IP: 0.0.0.0
# Internet IP: 176.58.124.96
echo -e ""
echo -e " ${ lightyellow } Server Resource ${ default } "
@ -122,21 +170,22 @@ fn_info_message_server_resource(){
}
fn_info_message_gameserver_resource( ) {
#
# Game Server Resource Usage
# ==========================================================================================================================================================================================================================================
# CPU Used: 2.5 %
# Mem Used: 2.1% 171 MB
# =================================
# CPU Used: 1.1 %
# Mem Used: 4.8% 189 MB
#
# Storage
# Total: 21G
# Serverfiles: 20G
# Backups: 20 K
# Total: 241M
# Serverfiles: 240M
# Backups: 24 K
echo -e ""
echo -e " ${ lightyellow } Game Server Resource Usage ${ default } "
fn_messages_separator
{
if [ " ${ status } " != "0" ] ; then
if [ " ${ status } " != "0" ] && [ -v status ] ; then
if [ -n " ${ cpuused } " ] ; then
echo -e " ${ lightblue } CPU Used:\t ${ default } ${ cpuused } % ${ default } "
else
@ -164,10 +213,12 @@ fn_info_message_gameserver_resource(){
}
fn_info_message_gameserver( ) {
#
# Counter-Strike: Global Offensive Server Details
# ==========================================================================================================================================================================================================================================
# =================================
# Server name: LinuxGSM
# Server IP: 80.70.189.230:27015
# Server IP: 0.0.0.0:27015
# Internet IP: 176.48.124.96:34197
# Server password: NOT SET
# RCON password: adminF54CC0VR
# Players: 0/16
@ -177,7 +228,7 @@ fn_info_message_gameserver(){
# Game mode: 0
# Tick rate: 64
# Master Server: listed
# Status: ONLINE
# Status: STARTED
echo -e ""
echo -e " ${ lightgreen } ${ gamename } Server Details ${ default } "
@ -212,11 +263,7 @@ fn_info_message_gameserver(){
fi
# Server ip
if [ " ${ multiple_ip } " = = "1" ] ; then
echo -e " ${ lightblue } Server IP:\t ${ default } NOT SET "
else
echo -e " ${ lightblue } Server IP:\t ${ default } ${ ip } : ${ port } "
fi
echo -e " ${ lightblue } Server IP:\t ${ default } ${ ip } : ${ port } "
# Internet ip
if [ -n " ${ extip } " ] ; then
@ -415,23 +462,22 @@ fn_info_message_gameserver(){
fi
fi
# Online status
# Game server status
if [ " ${ status } " = = "0" ] ; then
echo -e " ${ lightblue } Status:\t ${ red } OFFLINE ${ default } "
echo -e " ${ lightblue } Status:\t ${ red } STOPPED ${ default } "
else
echo -e " ${ lightblue } Status:\t ${ green } ONLINE ${ default } "
echo -e " ${ lightblue } Status:\t ${ green } STARTED ${ default } "
fi
} | column -s $'\t' -t
echo -e ""
}
fn_info_message_script( ) {
#
# csgoserver Script Details
#========================================================================================================================================================================================================= =================================
# Script name: csgoserver
# LinuxGSM version: v19.9.0
# glibc required: 2.15
# =================================
# Script name: csgoserver
# LinuxGSM version: v21.1.3
# glibc required: 2.18
# Discord alert: off
# Email alert: off
# IFTTT alert: off
@ -522,7 +568,7 @@ fn_info_message_script(){
fn_info_message_backup( ) {
#
# Backups
# =====================================
# =================================
# No. of backups: 1
# Latest backup:
# date: Fri May 6 18:34:19 UTC 2016
@ -554,7 +600,7 @@ fn_info_message_backup(){
fn_info_message_commandlineparms( ) {
#
# Command-line Parameters
# =====================================
# =================================
# ./run_server_x86.sh +set net_strict 1
echo -e ""
@ -564,41 +610,51 @@ fn_info_message_commandlineparms(){
if [ " ${ serverpassword } " = = "NOT SET" ] ; then
unset serverpassword
fi
fn_parms
echo -e " ${ preexecutable } ${ executable } ${ parms } "
if grep -qE "^[[:blank:]]*startparameters=" " ${ configdirserver } /secrets- ${ selfname } .cfg " ; then
eval startparameters = " $( sed -nr 's/^ *startparameters=(.*)$/\1/p' " ${ configdirserver } /secrets- ${ selfname } .cfg " ) "
elif grep -qE "^[[:blank:]]*startparameters=" " ${ configdirserver } / ${ selfname } .cfg " ; then
eval startparameters = " $( sed -nr 's/^ *startparameters=(.*)$/\1/p' " ${ configdirserver } / ${ selfname } .cfg " ) "
elif grep -qE "^[[:blank:]]*startparameters=" " ${ configdirserver } /secrets-common.cfg " ; then
eval startparameters = " $( sed -nr 's/^ *startparameters=(.*)$/\1/p' " ${ configdirserver } /secrets-common.cfg " ) "
elif grep -qE "^[[:blank:]]*startparameters=" " ${ configdirserver } /common.cfg " ; then
eval startparameters = " $( sed -nr 's/^ *startparameters=(.*)$/\1/p' " ${ configdirserver } /common.cfg " ) "
elif grep -qE "^[[:blank:]]*startparameters=" " ${ configdirserver } /_default.cfg " ; then
eval startparameters = " $( sed -nr 's/^ *startparameters=(.*)$/\1/p' " ${ configdirserver } /_default.cfg " ) "
fi
echo -e " ${ preexecutable } ${ executable } ${ startparameters } "
}
fn_info_message_ports( ) {
#
# Ports
# =====================================
# =================================
# Change ports by editing the parameters in:
# /home/lgsm/qlserver/serverfiles/baseq3/ql-server.cfg
echo -e ""
echo -e " ${ lightgreen } Ports ${ default } "
fn_messages_separator
echo -e " ${ lightblue } Change ports by editing the parameters in: ${ default } "
parmslocation = " ${ red } UNKNOWN ${ default } "
start para meter slocation= " ${ red } UNKNOWN ${ default } "
# engines/games that require editing in the config file.
local ports_edit_array = ( "avalanche2.0" "avalanche3.0" "Ballistic Overkill" "Barotrauma" "dontstarve" "Eco" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "Minecraft Bedrock" "Project Cars" "projectzomboid" "quake" "refractor" "realvirtuality" "renderware" "Stationeers" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "Vintage Story" "wurm" )
for port_edit in " ${ ports_edit_array [@] } " ; do
if [ " ${ shortname } " = = "ut3" ] ; then
parmslocation = " ${ servercfgdir } /UTWeb.ini "
start para meter slocation= " ${ servercfgdir } /UTWeb.ini "
elif [ " ${ shortname } " = = "kf2" ] ; then
parmslocation = " ${ servercfgdir } /LinuxServer-KFEngine.ini\n ${ servercfgdir } /KFWeb.ini "
start para meter slocation= " ${ servercfgdir } /LinuxServer-KFEngine.ini\n ${ servercfgdir } /KFWeb.ini "
elif [ " ${ engine } " = = " ${ port_edit } " ] || [ " ${ gamename } " = = " ${ port_edit } " ] ; then
parmslocation = " ${ servercfgfullpath } "
start para meter slocation= " ${ servercfgfullpath } "
fi
done
# engines/games that require editing the start parameters.
local ports_edit_array = ( "Avorion" "col" "goldsrc" "Factorio" "Hurtworld" "iw3.0" "ioquake3" "qfusion" "Rust" "scpsl" "scpslsm" "Soldat" "spark" "source" "starbound" "unreal4" "realvirtuality" "Unturned" "vh" )
for port_edit in " ${ ports_edit_array [@] } " ; do
if [ " ${ engine } " = = " ${ port_edit } " ] || [ " ${ gamename } " = = " ${ port_edit } " ] || [ " ${ shortname } " = = " ${ port_edit } " ] ; then
parmslocation = " ${ configdirserver } "
start para meter slocation= " ${ configdirserver } "
fi
done
echo -e " ${ parmslocation } "
echo -e " ${ start para meter slocation} "
echo -e ""
echo -e " ${ lightblue } Useful port diagnostic command: ${ default } "
}
@ -606,9 +662,9 @@ fn_info_message_ports(){
fn_info_message_statusbottom( ) {
echo -e ""
if [ " ${ status } " = = "0" ] ; then
echo -e " ${ lightblue } Status:\t ${ red } OFFLINE ${ default } "
echo -e " ${ lightblue } Status:\t ${ red } STOPPED ${ default } "
else
echo -e " ${ lightblue } Status:\t ${ green } ONLINE ${ default } "
echo -e " ${ lightblue } Status:\t ${ green } STARTED ${ default } "
fi
echo -e ""
}
@ -1406,7 +1462,7 @@ fn_info_message_mta(){
echo -e ""
{
echo -e " ${ lightblue } DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL ${ default } "
echo -e " > Game/Query\tOUT BOUND\t ${ port } \tudp "
echo -e " > Game/Query\tIN BOUND\t ${ port } \tudp "
echo -e " > HTTP Server\tINBOUND\t ${ httpport } \ttcp "
if [ " ${ ase } " = = "Enabled" ] ; then
echo -e " > Query Port\tOUTBOUND\t ${ queryport } \tudp "
@ -1642,50 +1698,3 @@ fn_info_message_select_engine(){
fn_print_error_nl "Unable to detect server engine."
fi
}
# Separator is different for details
fn_messages_separator( ) {
if [ " ${ commandname } " = = "details" ] ; then
printf '%*s\n' " ${ COLUMNS :- $( tput cols) } " '' | tr ' ' =
else
echo -e "================================="
fi
}
# Removes the passwords form all but details
fn_info_message_password_strip( ) {
if [ " ${ commandname } " != "DETAILS" ] ; then
if [ " ${ serverpassword } " ] ; then
serverpassword = "********"
fi
if [ " ${ rconpassword } " ] ; then
rconpassword = "********"
fi
if [ " ${ adminpassword } " ] ; then
adminpassword = "********"
fi
if [ " ${ statspassword } " ] ; then
statspassword = "********"
fi
if [ " ${ webadminpass } " ] ; then
webadminpass = "********"
fi
if [ " ${ telnetpass } " ] ; then
telnetpass = "********"
fi
if [ " ${ wsapikey } " ] ; then
wsapikey = "********"
fi
if [ " ${ gslt } " ] ; then
gslt = "********"
fi
fi
}