Browse Source

Major rename of functions

* All functions names have been reviewed and renamed to make it easier
to identify what the function is for. This is for my benefit as there
are now over 50 functions to manage.

* New details feature. It has been reworked to add more useful info and
fix any bugs with details not always being displayed.

* Main script file e.g csgoserver should no longer require any updates
from this point. All code modifications should be made from the
functions. Any future edits would relate to server specific config.

* servername variable has been moved to its own function if name is
gathered from a config file. The same applies for ports, usernames and
passwords.

* new function fn_details_distro gathers all the required OS info for
fn_details and other functions that require this info

* Various improvements and bug fixes that I cannot remember.
pull/276/head
Daniel Gibbs 10 years ago
parent
commit
c912c4d2bd
  1. 82
      7DaysToDie/sdtdserver
  2. 79
      Arma3/arma3server
  3. 80
      BladeSymphony/bsserver
  4. 79
      CounterStrike/csserver
  5. 79
      CounterStrikeConditionZero/csczserver
  6. 80
      CounterStrikeGlobalOffensive/csgoserver
  7. 79
      CounterStrikeSource/cssserver
  8. 79
      DayOfDefeat/dodserver
  9. 79
      DayOfDefeatSource/dodsserver
  10. 80
      FistfulOfFrags/fofserver
  11. 4
      GameServerQuery/gsquery.py
  12. 80
      GarrysMod/gmodserver
  13. 79
      HalfLife2Deathmatch/hl2dmserver
  14. 79
      HalfLifeDeathmatchClassic/hldmcserver
  15. 84
      Insurgency/insserver
  16. 78
      JustCause2/jc2server
  17. 102
      KillingFloor/kfserver
  18. 79
      Left4Dead/l4dserver
  19. 79
      Left4Dead2/l4d2server
  20. 79
      NaturalSelection2/ns2server
  21. 80
      NoMoreRoomInHell/nmrihserver
  22. 110
      RedOrchestra/roserver
  23. 75
      SeriousSam3BFE/ss3sserver
  24. 79
      TeamFortress2/tf2server
  25. 79
      TeamFortressClassic/tfcserver
  26. 95
      UnrealTournament2004/ut2k4server
  27. 96
      UnrealTournament99/ut99server
  28. 61
      functions/fn_backup
  29. 28
      functions/fn_check_ip
  30. 42
      functions/fn_check_logs
  31. 10
      functions/fn_check_root
  32. 33
      functions/fn_check_steamcmd
  33. 10
      functions/fn_check_systemdir
  34. 17
      functions/fn_check_tmux
  35. 33
      functions/fn_compress_unreal2maps
  36. 33
      functions/fn_compress_ut99maps
  37. 10
      functions/fn_console
  38. 2
      functions/fn_csgofix
  39. 59
      functions/fn_debug
  40. 574
      functions/fn_details
  41. 59
      functions/fn_details_config
  42. 90
      functions/fn_details_distro
  43. 44
      functions/fn_email
  44. 22
      functions/fn_email_test
  45. 122
      functions/fn_functions
  46. 126
      functions/fn_getopt
  47. 39
      functions/fn_install
  48. 12
      functions/fn_install_complete
  49. 246
      functions/fn_install_config
  50. 116
      functions/fn_install_glibcfix
  51. 30
      functions/fn_install_gsquery
  52. 18
      functions/fn_install_header
  53. 27
      functions/fn_install_kffix
  54. 42
      functions/fn_install_logs
  55. 14
      functions/fn_install_retry
  56. 27
      functions/fn_install_rofix
  57. 23
      functions/fn_install_serverdir
  58. 72
      functions/fn_install_serverfiles
  59. 26
      functions/fn_install_steamcmd
  60. 38
      functions/fn_install_steamfix
  61. 42
      functions/fn_install_ut2k4
  62. 54
      functions/fn_install_ut2k4filesdl
  63. 32
      functions/fn_install_ut2k4fix
  64. 18
      functions/fn_install_ut2k4key
  65. 42
      functions/fn_install_ut99
  66. 54
      functions/fn_install_ut99filesdl
  67. 24
      functions/fn_install_ut99fix
  68. 50
      functions/fn_logs
  69. 11
      functions/fn_messages
  70. 60
      functions/fn_monitor
  71. 85
      functions/fn_monitor_query
  72. 69
      functions/fn_start
  73. 29
      functions/fn_stop
  74. 189
      functions/fn_update_check
  75. 21
      functions/fn_update_dl
  76. 26
      functions/fn_validate

82
7DaysToDie/sdtdserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -24,6 +24,10 @@ fn_parms(){
parms="-configfile=\"${servercfgfullpath}\" -dedicated"
}
# Logging
# Number of days to keep script logs
logdays="7"
#### Advanced Variables ####
# Steam
@ -46,13 +50,9 @@ servercfgdir="${filesdir}"
servercfg="${servicename}.xml"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${filesdir}/serverconfig.xml"
backupdir="backups"
# Server Details
servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
backupdir="${rootdir}/backups"
# Logging
logdays="7"
gamelogdir="${rootdir}/log/server"
scriptlogdir="${rootdir}/log/script"
consolelogdir="${rootdir}/log/console"
@ -68,29 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -108,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
Arma3/arma3server

@ -4,7 +4,7 @@
# Author: Daniel Gibbs
# Contributor: Scarsz
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -45,10 +45,7 @@ executable="./arma3server"
servercfgdir="${systemdir}"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"| grep -v //|sed -e 's/\<hostname\>//g'| tr -d '=\"; ')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -66,31 +63,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -108,44 +80,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

80
BladeSymphony/bsserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,31 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -115,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
CounterStrike/csserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -50,11 +50,7 @@ servercfgdir="${systemdir}"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
CounterStrikeConditionZero/csczserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -50,11 +50,7 @@ servercfgdir="${systemdir}"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

80
CounterStrikeGlobalOffensive/csgoserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -68,11 +68,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -90,31 +86,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_csgofix
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -132,44 +103,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
CounterStrikeSource/cssserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,30 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -114,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
DayOfDefeat/dodserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -50,11 +50,7 @@ servercfgdir="${systemdir}"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
DayOfDefeatSource/dodsserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,30 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -114,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

80
FistfulOfFrags/fofserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,31 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -115,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

4
GameServerQuery/gsquery.py

@ -3,7 +3,7 @@
# Game Server Query
# Author: Anonymous & Daniel Gibbs
# # Website: http://danielgibbs.co.uk
# Version: 231214
# Version: 210115
import optparse
import socket
@ -101,7 +101,7 @@ if __name__ == '__main__':
action = 'store',
dest = 'engine',
default = False,
help = 'Engine type: avalanche, goldsource, realvirtuality, spark, source, unreal, unreal2.'
help = 'Engine type: avalanche, goldsource, realvirtuality, spark, source, unity3d, unreal, unreal2.'
)
parser.add_option(
'-v', '--verbose',

80
GarrysMod/gmodserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -56,11 +56,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -78,31 +74,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -120,44 +91,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
HalfLife2Deathmatch/hl2dmserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,30 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -114,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
HalfLifeDeathmatchClassic/hldmcserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -50,11 +50,7 @@ servercfgdir="${systemdir}"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

84
Insurgency/insserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -13,8 +13,8 @@ emailnotification="off"
email="[email protected]"
# Steam login
steamuser="username"
steampass="password"
steamuser="anonymous"
steampass=""
# Start Variables
defaultmap="ministry"
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,31 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -115,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

78
JustCause2/jc2server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -46,10 +46,7 @@ executable="./Jcmp-Server"
servercfgdir="${filesdir}"
servercfg="config.lua"
servercfgfullpath="${servercfgdir}/${servercfg}"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -67,30 +64,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -108,44 +81,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

102
KillingFloor/kfserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -17,17 +17,24 @@ steamuser="username"
steampass="password"
# Start Variables
fn_parms(){
defaultmap="KF-BioticsLab.rom"
parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${ini} log=${gamelog}"
ip="0.0.0.0"
fn_parms(){
parms="server ${defaultmap}?game=KFmod.KFGameType?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}"
# Start Variables for Objective mode
#defaultmap="KFO-Steamland"
#parms="server ${defaultmap}?Game=KFStoryGame.KFStoryGame?VACSecured=true -nohomedir ini=${ini} log=${gamelog}"
#parms="server ${defaultmap}?Game=KFStoryGame.KFStoryGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}"
}
#### Advanced Variables ####
# Server Details
servicename="kf-server"
gamename="Killing Floor"
engine="unreal2"
# Steam
appid="215360"
@ -39,17 +46,12 @@ filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
executabledir="${systemdir}"
executable="./ucc-bin"
servercfgdir="${systemdir}"
servercfg="${servicename}.ini"
servercfgfullpath="${servercfgdir}/${servercfg}"
compressedmapsdir="${rootdir}/Maps-Compressed"
defaultcfg="${systemdir}/Default.ini"
backupdir="backups"
# Server Details
servicename="kf-server"
gamename="Killing Floor"
engine="unreal2"
ini="${servicename}.ini"
servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
ip="0.0.0.0"
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -69,31 +71,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_kffix
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -111,46 +88,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
map-compressor)
fn_unreal2compressmaps;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
Left4Dead/l4dserver

@ -4,7 +4,7 @@
# Author: Daniel Gibbs
# Contributor: Summit Singh Thakur
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,30 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -114,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
Left4Dead2/l4d2server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -50,11 +50,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
NaturalSelection2/ns2server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -17,7 +17,6 @@ steamuser="username"
steampass="password"
# Start Variables
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
defaultmap="ns2_summit"
port="27015"
maxplayers="24"
@ -34,9 +33,11 @@ password=""
# that the password variable above is not left empty.
# -password \"${password}\"
# http://wiki.unknownworlds.com/ns2/Dedicated_Server
fn_parms(){
parms="-name \"${servername}\" -port ${port} -webadmin -webdomain ${ip} -webuser ${webadminuser} -webpassword \"${webadminpass}\" -webport ${webadminport} -map ${defaultmap} -limit ${maxplayers} -config_path \"${rootdir}/${configpath}\" -modstorage \"${rootdir}/${modstorage}\" -mods \"${mods}\""
}
#### Advanced Variables ####
# Steam
@ -48,13 +49,14 @@ gamename="Natural Selection 2"
engine="spark"
# Directories
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
selfname="$0"
lockselfname=$(echo ".${servicename}.lock")
filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}"
executabledir="${filesdir}"
executable="./server_linux32"
backupdir="backups"
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +74,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +91,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

80
NoMoreRoomInHell/nmrihserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,31 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -115,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

110
RedOrchestra/roserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -16,6 +16,21 @@ email="[email protected]"
steamuser="username"
steampass="password"
# Start Variables
defaultmap="RO-Arad.rom"
ip="0.0.0.0"
fn_parms(){
parms="server ${defaultmap}?game=ROGame.ROTeamGame?VACSecured=true -nohomedir ini=${servercfg} log=${gamelog}"
}
#### Advanced Variables ####
# Server Details
servicename="ro-server"
gamename="Red Orchestra: Ostfront 41-45"
engine="unreal2"
# Steam
appid="223250"
@ -27,17 +42,12 @@ filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/system"
executabledir="${systemdir}"
executable="./ucc-bin"
servercfgdir="${systemdir}"
servercfg="${servicename}.ini"
servercfgfullpath="${servercfgdir}/${servercfg}"
compressedmapsdir="${rootdir}/Maps-Compressed"
defaultcfg="${systemdir}/default.ini"
backupdir="backups"
# Server Details
servicename="ro-server"
gamename="Red Orchestra: Ostfront 41-45"
engine="unreal2"
ini="${servicename}.ini"
servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
ip="0.0.0.0"
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -54,40 +64,9 @@ gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').log"
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
# Start Variables
fn_parms(){
defaultmap="RO-Arad.rom"
parms="server ${defaultmap}?game=ROGame.ROTeamGame?VACSecured=true -nohomedir ini=${ini} log=${gamelog}"
}
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_rofix
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -105,46 +84,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
map-compressor)
fn_unreal2compressmaps;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

75
SeriousSam3BFE/ss3sserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -45,7 +45,7 @@ executable="./runSam3_DedicatedServer.sh"
servercfgdir="${filesdir}/Content/SeriousSam3/Config"
servercfg="${servicename}.ini"
servercfgfullpath="${servercfgdir}/${servercfg}"
backupdir="backups"
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -65,30 +65,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_glibcfix
fn_loginstall
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -106,44 +82,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
TeamFortress2/tf2server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -51,11 +51,7 @@ servercfgdir="${systemdir}/cfg"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -73,30 +69,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -114,44 +86,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

79
TeamFortressClassic/tfcserver

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -50,11 +50,7 @@ servercfgdir="${systemdir}"
servercfg="${servicename}.cfg"
servercfgfullpath="${servercfgdir}/${servercfg}"
defaultcfg="${servercfgdir}/server.cfg"
backupdir="backups"
# Server Details
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -72,30 +68,6 @@ consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_steamdl
fn_steaminstall
fn_steamfix
fn_loginstall
fn_getquery
fn_serverconfig
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -113,44 +85,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
update)
norestart=1;
fn_versioncheck;;
update-restart)
fn_versioncheck;;
validate)
fn_validateserver;;
validate-restart)
fn_stopserver
fn_validateserver
fn_startserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

95
UnrealTournament2004/ut2k4server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -12,6 +12,19 @@
emailnotification="off"
email="[email protected]"
# Start Variables
defaultmap="DM-Rankin"
ip="0.0.0.0"
fn_parms(){
parms="server ${defaultmap}?game=XGame.xDeathMatch -nohomedir ini=${servercfg} log=${gamelog}"
}
# Server Details
servicename="ut2k4-server"
gamename="Unreal Tournament 2004"
engine="unreal2"
# Directories
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
selfname="$0"
@ -20,17 +33,12 @@ filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
executabledir="${systemdir}"
executable="./ucc-bin"
servercfgdir="${systemdir}"
servercfg="${servicename}.ini"
servercfgfullpath="${servercfgdir}/${servercfg}"
compressedmapsdir="${rootdir}/Maps-Compressed"
defaultcfg="${systemdir}/UT2004.ini"
backupdir="backups"
# Server Details
servicename="ut2k4-server"
gamename="Unreal Tournament 2004"
engine="unreal2"
ini="${servicename}.ini"
servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
ip="0.0.0.0"
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -47,40 +55,9 @@ gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').log"
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
# Start Variables
fn_parms(){
defaultmap="DM-Rankin"
parms="server ${defaultmap}?game=XGame.xDeathMatch -nohomedir ini=${ini} log=${gamelog}"
}
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_ut2k4filesdl
fn_ut2k4install
fn_ut2k4key
fn_loginstall
fn_getquery
fn_serverconfig
fn_ut2k4fix
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -98,33 +75,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
map-compressor)
fn_unreal2compressmaps;;
*)
echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

96
UnrealTournament99/ut99server

@ -3,7 +3,7 @@
# Server Management Script
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
#### Variables ####
@ -12,6 +12,21 @@
emailnotification="off"
email="[email protected]"
# Start Variables
defaultmap="DM-Deck16]["
ip="0.0.0.0"
fn_parms(){
parms="server ${defaultmap}.unr ini=${servercfgfullpath}"
}
#### Advanced Variables ####
# Server Details
servicename="ut99-server"
gamename="Unreal Tournament 99"
engine="unreal"
# Directories
rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
selfname="$0"
@ -20,17 +35,12 @@ filesdir="${rootdir}/serverfiles"
systemdir="${filesdir}/System"
executabledir="${systemdir}"
executable="./ucc-bin"
servercfgdir="${systemdir}"
servercfg="${servicename}.ini"
servercfgfullpath="${servercfgdir}/${servercfg}"
compressedmapsdir="${rootdir}/Maps-Compressed"
defaultcfg="${systemdir}/Default.ini"
backupdir="backups"
# Server Details
servicename="ut99-server"
gamename="Unreal Tournament 99"
engine="unreal"
ini="${servicename}.ini"
servername=$(grep -s ServerName= ${systemdir}/${ini}|sed 's/ServerName=//g')
ip="0.0.0.0"
backupdir="${rootdir}/backups"
# Logging
logdays="7"
@ -44,39 +54,9 @@ emaillog="${scriptlogdir}/${servicename}-email.log"
scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
# Start Variables
fn_parms(){
defaultmap="DM-Deck16]["
parms="server ${defaultmap}.unr ini=${systemdir}/${ini}"
}
##### Script #####
# Do not edit
fn_install(){
fn_rootcheck
fn_header
if [ -z "${autoinstall}" ]; then
fn_serverdirectory
fn_header
fi
fn_ut99filesdl
fn_ut99install
fn_loginstall
fn_getquery
fn_serverconfig
fn_ut99fix
fn_header
fn_details
fn_installcomplete
}
fn_functions(){
# Functions are defines in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_runfunction(){
# Functions are downloaded and run with this function
if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
@ -94,33 +74,13 @@ fi
source "${rootdir}/functions/${functionfile}"
}
fn_functions(){
# Functions are defined in fn_functions.
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_functions
case "$1" in
start)
fn_startserver;;
stop)
fn_stopserver;;
restart)
fn_restartserver;;
monitor)
fn_monitorserver;;
email-test)
fn_emailtest;;
details)
fn_details;;
backup)
fn_backupserver;;
console)
fn_console;;
debug)
fn_debugserver;;
install)
fn_install;;
map-compressor)
fn_ut99compressmaps;;
*)
echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
exit 1;;
esac
exit
getopt=$1
fn_getopt

61
functions/fn_backup

@ -0,0 +1,61 @@
#!/bin/bash
# LGSM fn_backup function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Creates a .tar.gz file in the backup directory.
local modulename="Backup"
fn_check_root
fn_check_systemdir
backupname="${servicename}-$(date '+%Y-%m-%d-%H%M%S')"
echo ""
echo "${gamename} Backup"
echo "============================"
echo ""
echo "The following backup will be created:"
echo ""
echo "${backupdir}/${backupname}.tar.gz"
echo ""
while true; do
read -p "Continue? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1;;
* ) echo "Please answer yes or no.";;
esac
done
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
if [ "${tmuxwc}" -eq 1 ]; then
echo ""
fn_printwarningnl "${servicename} is currently running."
sleep 1
while true; do
read -p "Stop ${servicename} while running the backup? [y/N]" yn
case $yn in
[Yy]* ) fn_stop; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
fi
fn_scriptlog "Started"
echo -en "starting backup.\r"
sleep 1
echo -en "starting backup..\r"
sleep 1
echo -en "starting backup...\r"
sleep 1
echo -en "\n"
cd "${rootdir}"
mkdir -pv "${backupdir}" > /dev/null 2>&1
tar -cvzf "${backupdir}/${backupname}.tar.gz" --exclude "${backupdir}" ./*
echo ""
echo "Backup created: ${backupdir}/${backupname}.tar.gz"
fn_scriptlog "Created: ${backupdir}/${backupname}.tar.gz"
sleep 1
echo ""
fn_printcompletenl "Complete."
fn_scriptlog "Complete"
echo ""

28
functions/fn_check_ip

@ -0,0 +1,28 @@
#!/bin/bash
# LGSM fn_check_ip function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Automatically identifies the server interface IP.
# If multiple interfaces are detected the user will need to manualy set using ip="0.0.0.0".
if [ ! -f /bin/ip ]; then
ipcommand="/sbin/ip"
else
ipcommand="ip"
fi
getip=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -v 127.0.0)
getipwc=$(${ipcommand} -o -4 addr|awk '{print $4 }'|grep -oe '\([0-9]\{1,3\}\.\?\)\{4\}'|grep -vc 127.0.0)
if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
if [ "${getipwc}" -ge "2" ]; then
fn_printwarn "Multiple active network interfaces found.\n\n"
echo -en "Manually specify the IP you want to use within the ${selfname} script.\n"
echo -en "Set ip=\"0.0.0.0\" to one of the following:\n"
echo -en "${getip}\n"
exit
else
ip=${getip}
fi
fi

42
functions/fn_check_logs

@ -0,0 +1,42 @@
#!/bin/bash
# LGSM fn_install_logs function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo ""
echo "Creating log directorys"
echo "================================="
sleep 1
# Create dir's for the script and console logs
mkdir -v "${rootdir}/log"
mkdir -v "${scriptlogdir}"
touch "${scriptlog}"
mkdir -v "${consolelogdir}"
touch "${consolelog}"
# If a server is source or goldsource create a symbolic link to the game server logs
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
if [ ! -h "${rootdir}/log/server" ]; then
ln -sv "${gamelogdir}" "${rootdir}/log/server"
else
echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!"
fi
fi
# If a server is unreal2 or unity3d create a dir
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then
mkdir -pv "${gamelogdir}"
fi
if [ "${gamename}" == "7 Days To Die" ]; then
if [ ! -h "${gamelogdir}/output_log.txt" ]; then
ln -sv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt"
fi
fi
# If server uses SteamCMD create a symbolic link to the Steam logs
if [ -d "${rootdir}/Steam/logs" ]; then
if [ ! -h "${rootdir}/log/steamcmd" ]; then
ln -sv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
else
echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!"
fi
fi
sleep 1

10
functions/fn_check_root

@ -0,0 +1,10 @@
#!/bin/bash
# LGSM fn_check_root function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
if [ $(whoami) = "root" ]; then
fn_printfailnl "Do NOT run this script as root!"
exit
fi

33
functions/fn_check_steamcmd

@ -0,0 +1,33 @@
#!/bin/bash
# LGSM fn_check_steamcmd function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Downloads SteamCMD on install and checks if missing before running functions that require SteamCMD
if [ "${gamename}" == "Unreal Tournament 99" ]||[ "${gamename}" == "Unreal Tournament 2004" ]; then
: # These servers do not require SteamCMD. Check is skipped.
elif [ "${modulename}" == "Starting" ]||[ "${modulename}" == "Update" ]; then
# Checks if SteamCMD exists when starting or updating a server.
# Re-installs if missing.
if [ ! -f ${rootdir}/steamcmd/steamcmd.sh ]; then
fn_details_config
fn_printwarn "SteamCMD is missing"
fn_scriptlog "SteamCMD is missing"
sleep 1
echo -en "\n"
mkdir -pv "${rootdir}/steamcmd"
cd "${rootdir}/steamcmd"
echo -e "downloading steamcmd_linux.tar.gz...\c"
wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
tar --verbose -zxf steamcmd_linux.tar.gz
rm -v steamcmd_linux.tar.gz
chmod +x steamcmd.sh
fn_scriptlog "Re-installed SteamCMD"
fn_printdots "${servername}"
sleep 1
fi
cd "${rootdir}"
fi

10
functions/fn_check_systemdir

@ -0,0 +1,10 @@
#!/bin/bash
# LGSM fn_check_systemdir function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
if [ ! -e "${systemdir}" ]; then
fn_printfailnl "Cannot access ${systemdir}: No such directory"
exit
fi

17
functions/fn_check_tmux

@ -0,0 +1,17 @@
#!/bin/bash
# LGSM fn_check_tmux function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Checks if tmux is installed as too many users do not RTFM or know how to use Google.
if [ -z $(command -v tmux) ]; then
fn_printfailnl "Tmux not installed"
sleep 1
fn_scriptlog "Tmux is not installed"
echo " * Tmux is required to run this server."
# Suitable passive agressive message
echo " * Please see 'Prerequisites' section of installation instructions."
exit
fi

33
functions/fn_compress_unreal2maps

@ -0,0 +1,33 @@
#!/bin/bash
# LGSM fn_compress_unreal2maps function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_check_root
clear
echo "${gamename} Map Compressor"
echo "============================"
echo "Will compress all maps in:"
echo ""
pwd
echo ""
echo "Compressed maps saved to:"
echo ""
echo "${compressedmapsdir}"
echo ""
while true; do
read -p "Start compression [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1;;
* ) echo "Please answer yes or no.";;
esac
done
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${filesdir}/Maps/*.uz2"
cd "${systemdir}"
for map in `ls "${filesdir}/Maps"`; do
./ucc-bin compress "../Maps/${map}" --nohomedir
done
mv -fv "${filesdir}/Maps/*.uz2" "${compressedmapsdir}"

33
functions/fn_compress_ut99maps

@ -0,0 +1,33 @@
#!/bin/bash
# LGSM fn_compress_ut99maps function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_check_root
clear
echo "${gamename} Map Compressor"
echo "============================"
echo "Will compress all maps in:"
echo ""
pwd
echo ""
echo "Compressed maps saved to:"
echo ""
echo "${compressedmapsdir}"
echo ""
while true; do
read -p "Start compression [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1;;
* ) echo "Please answer yes or no.";;
esac
done
mkdir -pv "${compressedmapsdir}" > /dev/null 2>&1
rm -rfv "${filesdir}/Maps/*.unr.uz"
cd "${systemdir}"
for map in `ls "${filesdir}/Maps"`; do
./ucc-bin compress ../Maps/${map} --nohomedir
done
mv -fv "${filesdir}/Maps/*.unr.uz" "${compressedmapsdir}"

10
functions/fn_console

@ -2,13 +2,13 @@
# LGSM fn_console function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
# Description: Gives access to the server tmux console.
local modulename="Console"
fn_rootcheck
fn_syscheck
fn_check_root
fn_check_systemdir
echo ""
echo "${gamename} Console"
echo "============================"
@ -26,7 +26,7 @@ esac
done
fn_printdots "Starting"
sleep 1
fn_tmuxcheck
fn_check_tmux
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
if [ "${tmuxwc}" -eq 1 ]; then
fn_printoknl "Starting"
@ -40,7 +40,7 @@ else
while true; do
read -p "Do you want to start the server? [y/N]" yn
case $yn in
[Yy]* ) fn_startserver; break;;
[Yy]* ) fn_start; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac

2
functions/fn_csgofix

@ -2,7 +2,7 @@
# LGSM fn_csgofix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
# Description: Resolves various issues with csgo.

59
functions/fn_debug

@ -0,0 +1,59 @@
#!/bin/bash
# LGSM fn_debug function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Runs the server without tmux. Runs direct from the terminal.
local modulename="Debug"
fn_check_root
fn_check_systemdir
fn_check_ip
fn_details_distro
fn_parms
echo ""
echo "${gamename} Debug"
echo "============================"
echo ""
echo -e "Distro: ${os}"
echo -e "Arch: ${arch}"
echo -e "Kernel: ${kernel}"
echo -e "Hostname: $HOSTNAME"
echo ""
echo "Start parameters:"
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
echo "${executable} ${parms} -debug"
else
echo "${executable} ${parms}"
fi
echo ""
echo -e "Use for identifying server issues only!"
echo -e "Press CTRL+c to drop out of debug mode."
fn_printwarningnl "If ${servicename} is already running it will be stopped."
echo ""
while true; do
read -p "Continue? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1;;
* ) echo "Please answer yes or no.";;
esac
done
fn_scriptlog "Starting debug"
fn_printinfonl "Stopping any running servers"
fn_scriptlog "Stopping any running servers"
sleep 1
fn_stop
fn_printdots "Starting debug"
sleep 1
fn_printok "Starting debug"
fn_scriptlog "Started debug"
sleep 1
echo -en "\n"
cd "${executabledir}"
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
${executable} ${parms} -debug
else
${executable} ${parms}
fi

574
functions/fn_details

@ -2,294 +2,384 @@
# LGSM fn_details function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 291214
# Version: 210115
# Description: Displays server infomation.
fn_avalanchedetails(){
fn_autoip
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
# Standard Details
# This applies to all engines
fn_details_os(){
echo -e ""
echo -e "\e[93mDistro Details\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mDistro:£\e[0m${os}" >> .fn_details_distro
echo -e "\e[34mArch:£\e[0m${arch}" >> .fn_details_distro
echo -e "\e[34mKernel:£\e[0m${kernel}" >> .fn_details_distro
echo -e "\e[34mHostname:£\e[0m$HOSTNAME" >> .fn_details_distro
echo -e "\e[34mtmux:£\e[0m${tmuxv}" >> .fn_details_distro
echo -e "\e[34mGLIBC:£\e[0m${glibcv}" >> .fn_details_distro
column -s '£' -t .fn_details_distro
rm -f .fn_details_distro
}
fn_details_performance(){
echo -e ""
echo -e "\e[93mPerformance\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mUptime:£\e[0m${days}d, ${hours}h, ${minutes}m" >> .fn_details_performance
echo -e "\e[34mAvg Load:£\e[0m${load}" >> .fn_details_performance
column -s '£' -t .fn_details_performance
rm -f .fn_details_performance
echo -e ""
echo -e "\e[34mMem:£\e[34mtotal£ used£ free\e[0m" >> .fn_details_performance
echo -e "\e[34mPhysical:£\e[0m${physmemtotal}£${physmemused}£${physmemfree}\e[0m" >> .fn_details_performance
echo -e "\e[34mSwap:£\e[0m${swaptotal}£${swapused}£${swapfree}\e[0m" >> .fn_details_performance
column -s '£' -t .fn_details_performance
rm -f .fn_details_performance
}
fn_details_disk(){
echo -e ""
echo -e "\e[93mDisk Usage\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mDisk available:£\e[0m${availspace}" >> .fn_details_disk
echo -e "\e[34mServerfiles:£\e[0m${serverfilesdu}" >> .fn_details_disk
if [ -d "${backupdir}" ]; then
echo -e "\e[34mBackups:£\e[0m${backupdirdu}" >> .fn_details_disk
fi
column -s '£' -t .fn_details_disk
rm -f .fn_details_disk
}
fn_details_gameserver(){
if [ ! -e ${servercfgfullpath} ]; then
servername="\e[0;31mCONFIG FILE MISSING!\e[0m"
rcon="\e[0;31mCONFIG FILE MISSING!\e[0m"
servercfgfullpath="${servercfgfullpath} \e[0;31mCONFIG FILE MISSING!!\e[0m"
fi
echo -e ""
echo -e "\e[92m${gamename} Server Details\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mServer name:£\e[0m${servername}" >> .fn_details_gameserver
echo -e "\e[34mServer IP:£\e[0m${ip}:${port}" >> .fn_details_gameserver
if [ ! -z "${rcon}" ]; then
echo -e "\e[34mRCON password:£\e[0m${rcon}" >> .fn_details_gameserver
fi
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${port}"
echo "Config file: ${servercfgfullpath}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game port ${port}"
echo ""
echo "You can change ports by editing the"
echo "start parameters in ${selfname}."
echo ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
echo -e "\e[34mStatus:£\e[0;31mOFFLINE\e[0m" >> .fn_details_gameserver
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
echo -e "\e[34mStatus:£\e[0;32mONLINE\e[0m" >> .fn_details_gameserver
fi
echo ""
column -s '£' -t .fn_details_gameserver
rm -f .fn_details_gameserver
echo -e ""
echo -e "\e[34mService name:£\e[0m${servicename}" >> .fn_details_gameserver
echo -e "\e[34mUser:£\e[0m$(whoami)" >> .fn_details_gameserver
echo -e "\e[34mLocation:£\e[0m${rootdir}" >> .fn_details_gameserver
if [ ! -z "${servercfgfullpath}" ]; then
echo -e "\e[34mConfig file:£\e[0m${servercfgfullpath}" >> .fn_details_gameserver
fi
column -s '£' -t .fn_details_gameserver
rm -f .fn_details_gameserver
}
fn_realvirtualitydetails(){
fn_autoip
servername=$(grep -s hostname "${servercfgfullpath}"|grep -v //|sed -e 's/\<hostname\>//g'|tr -d '=\"; ')
serverport=$(grep -s serverport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
masterport=$(grep -s steamport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${serverport}"
echo "Config file: ${servercfgfullpath}"
echo ""
echo "Admin Password: ${adminpass}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
if [ -z ${serverport} ] || [ -z ${queryport} ] || [ -z ${masterport} ] ; then
echo -e "\e[0;31mERROR!\e[0;39m Missing/commented ports in ${servercfg}."
echo ""
fn_details_backup(){
echo -e ""
echo -e "\e[92mBackups\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
if [ ! -d "${backupdir}" ]||[ "${backupcount}" == "0" ]; then
echo -e "No Backups created"
else
echo -e "\e[34mNo. of backups:£\e[0m${backupcount}" >> .fn_details_backup
echo -e "\e[34mLatest backup:\e[0m" >> .fn_details_backup
echo -e "\e[34m date:£\e[0m${lastbackupdate}" >> .fn_details_backup
echo -e "\e[34m file:£\e[0m${lastbackup}" >> .fn_details_backup
echo -e "\e[34m size:£\e[0m${lastbackupsize}" >> .fn_details_backup
column -s '£' -t .fn_details_backup
rm -f .fn_details_backup
fi
echo "PROTOCOL DESCRIPTION PORT"
echo "UDP Game port ${serverport}"
echo "UDP STEAM query port ${queryport}"
echo "UDP STEAM master traffic port ${masterport}"
echo ""
echo "You can change ports by editing the"
echo "parameters in ${servercfgfullpath}"
echo ""
}
fn_details_commandlineparms(){
echo -e ""
echo -e "\e[92mCommand-line Parameters\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "${executable} ${parms}"
}
fn_details_statusbottom(){
echo -e ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
echo -e "\e[34mStatus: \e[0;31mOFFLINE\e[0m"
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
echo -e "\e[34mStatus: \e[0;32mONLINE\e[0m"
fi
echo ""
echo -e ""
}
fn_seriousengine35details(){
fn_autoip
fn_parms
servername=$(grep -s prj_strMultiplayerSessionName "${servercfgfullpath}"|sed 's/prj_strMultiplayerSessionName = //g'|sed 's/"//g'|sed 's/;//g')
rcon=$(grep -s rcts_strAdminPassword "${servercfgfullpath}"|sed 's/rcts_strAdminPassword = //g'|sed 's/"//g'|sed 's/;//g')
gameport=$(grep -s prj_uwPort "${servercfgfullpath}"|tr -d '\r'|tr -cd [:digit:])
queryport=$((${gameport} + 1))
# Engine Specific details
fn_avalanchedetails(){
fn_check_ip
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${port}"
echo "RCON password: ${rcon}"
echo "Config file: ${servercfgfullpath}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
echo "INBOUND Query port ${queryport}"
echo ""
echo "You can change ports by editing the"
echo "parameters in ${servercfgfullpath}"
echo ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the command-line"
echo -e "parameters in ${selfname}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep Jcmp-Server"
echo -e ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
echo -e "> Game/RCON£INBOUND£${port}£udp" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
fn_realvirtualitydetails(){
fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
fn_parms
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the parameters in"
echo -e "${servercfgfullpath}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep arma3server"
echo -e ""
if [ -z ${port} ] || [ -z ${queryport} ] || [ -z ${masterport} ] ; then
echo -e "\e[0;31mERROR!\e[0m Missing/commented ports in ${servercfg}."
echo -e ""
fi
echo ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
echo -e "> Game£INBOUND£${port}£udp" >> .fn_details_ports
echo -e "> Steam: Query£INBOUND£${queryport}£udp" >> .fn_details_ports
echo -e "> Steam: Master traffic£INBOUND£${masterport}£udp" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
fn_seriousengine35details(){
fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
fn_parms
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the parameters in"
echo -e "${servercfgfullpath}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep Sam3_Dedicate"
echo -e ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
echo -e "> Game/RCON£INBOUND£${port}£tcp" >> .fn_details_ports
echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
fn_sourcedetails(){
fn_autoip
fn_check_ip
fn_parms
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${port}"
echo "RCON password: ${rcon}"
echo "Config file: ${servercfgfullpath}"
echo ""
echo "Start Parameters"
echo "============================"
echo "${executable} ${parms}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the command-line"
echo -e "parameters in ${selfname}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep srcds_linux"
echo -e ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
echo -e "> Game/RCON£INBOUND£${port}£tcp/udp" >> .fn_details_ports
if [ ! -z "${sourcetvport}" ]; then
echo "INBOUND SourceTV port ${sourcetvport}"
echo -e "> SourceTV£INBOUND£${sourcetvport}£udp" >> .fn_details_ports
fi
echo "OUTBOUND Client port ${clientport}"
echo ""
echo "You can change ports by editing the"
echo "start parameters in ${selfname}."
echo ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
fi
echo ""
echo -e "< Client£OUTBOUND£${clientport}£udp" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
fn_sparkdetails(){
fn_autoip
queryport=$((${port} + 1))
fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${port}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game/RCON port ${port}"
echo "INBOUND Query port ${queryport}"
echo "INBOUND WebAdmin ${webadminport}"
echo ""
echo "${servername} WebAdmin"
echo "======================="
echo "WebAdmin URL: http://${ip}:${webadminport}/index.html"
echo "WebAdmin Username: ${webadminuser}"
echo "WebAdmin Password: ${webadminpass}"
echo ""
echo "You can change various parameters by editing the"
echo "start parameters in ${selfname}."
echo ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
fi
echo ""
fn_parms
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the command-line"
echo -e "parameters in ${selfname}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep server_linux3"
echo -e ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
echo -e "> Game/RCON£INBOUND£${port}£udp" >> .fn_details_ports
echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
echo -e "> WebAdmin£INBOUND£${webadminport}£tcp" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
echo -e ""
echo -e "\e[92m${servername} WebAdmin\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mWebAdmin url:£\e[0mhttp://${ip}:${webadminport}/index.html" >> .fn_details_ports
echo -e "\e[34mWebAdmin username:£\e[0m${webadminuser}" >> .fn_details_ports
echo -e "\e[34mWebAdmin password:£\e[0m${webadminpass}" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
fn_unity3ddetails(){
fn_autoip
fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd [:digit:])
queryport=$((${gameport} + 1))
webadminenabled=$(grep ControlPanelEnabled "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
webadminport=$(grep ControlPanelPort "${servercfgfullpath}"|tr -cd [:digit:])
telnetport=$(grep TelnetPort "${servercfgfullpath}"|tr -cd [:digit:])
webadminuser=$(grep ControlPanelPassword "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${gameport}"
echo "Config file: ${servercfgfullpath}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT"
echo "INBOUND Game port ${gameport}"
echo "INBOUND Query port ${queryport}"
echo "INBOUND WebAdmin ${webadminport}"
echo "INBOUND Telnet ${telnetport}"
echo ""
echo "${servername} WebAdmin"
echo "======================="
echo "WebAdmin Enabled: ${webadminenabled}"
echo "WebAdmin URL: http://${ip}:${webadminport}"
echo "WebAdmin Username: ${webadminuser}"
echo ""
echo "You can change ports by editing the"
echo "parameters in ${servercfgfullpath}"
echo ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
fi
echo ""
fn_parms
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the parameters in"
echo -e "${servercfgfullpath}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep 7DaysToDie"
echo -e ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL" >> .fn_details_ports
echo -e "> Game/RCON£INBOUND£${port}£udp" >> .fn_details_ports
echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
echo -e "> WebAdmin£INBOUND£${webadminport}£tcp" >> .fn_details_ports
echo -e "> Telnet£INBOUND£${telnetport}£tcp" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
echo -e ""
echo -e "\e[92m${servername} WebAdmin\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mWebAdmin enabled:£\e[0m${webadminenabled}" >> .fn_details_ports
echo -e "\e[34mWebAdmin url:£\e[0mhttp://${ip}:${webadminport}" >> .fn_details_ports
echo -e "\e[34mWebAdmin password:£\e[0m${webadminpass}" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
echo -e ""
echo -e "\e[92m${servername} Telnet\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mTelnet enabled:£\e[0m${telnetenabled}" >> .fn_details_ports
echo -e "\e[34mTelnet address:£\e[0m${ip}:${telnetport}" >> .fn_details_ports
echo -e "\e[34mTelnet password:£\e[0m${telnetpass}" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
fn_unrealdetails(){
fn_autoip
fn_check_ip
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -E "^${servicename}:"|wc -l)
gameport=$(grep Port= "${systemdir}/${ini}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:])
queryport=$((${gameport} + 1))
gsqueryport=$(grep OldQueryPortNumber= "${systemdir}/${ini}"|tr -d '\r'|tr -cd [:digit:])
udplinkport=$((${gameport} + 2))
webadminport=$(grep ListenPort= "${systemdir}/${ini}"|tr -d '\r'|tr -cd [:digit:])
if [ "${engine}" == "unreal" ]; then
webadminuser=$(grep AdminUsername= "${systemdir}/${ini}"|sed 's/\AdminUsername=//g')
else
webadminuser=$(grep AdminName= "${systemdir}/${ini}"|sed 's/\AdminName=//g')
fi
webadminpass=$(grep AdminPassword= "${systemdir}/${ini}"|sed 's/\AdminPassword=//g')
echo ""
echo "${gamename} Server Details"
echo "============================"
echo "Server name: ${servername}"
echo "Server IP: ${ip}:${gameport}"
echo "Config file: ${systemdir}/${ini}"
echo ""
echo "Server Ports"
echo "============================"
echo "Ports the server is currently using."
echo ""
echo "DIRECTION DESCRIPTION PORT INI VARIABLE"
echo "INBOUND Game port ${gameport} UDP Port=${gameport}"
echo "INBOUND Query port ${queryport} UDP n/a"
fn_parms
fn_details_config
fn_details_distro
fn_details_os
fn_details_performance
fn_details_disk
fn_details_gameserver
fn_details_backup
fn_details_commandlineparms
echo -e ""
echo -e "\e[92mPorts\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "Change ports by editing the parameters in"
echo -e "${servercfgfullpath}."
echo -e ""
echo -e "Useful port diagnostic command:"
echo -e "netstat -atunp | grep ucc-bin"
echo -e ""
echo -e "DESCRIPTION£DIRECTION£PORT£PROTOCOL£INI VARIABLE" >> .fn_details_ports
echo -e "> Game£INBOUND£${port}£udp£Port=${port}" >> .fn_details_ports
echo -e "> Query£INBOUND£${queryport}£udp" >> .fn_details_ports
if [ "${engine}" == "unreal" ]; then
echo "OUTBOUND UdpLink Port (random) ${udplinkport}+ UDP n/a"
echo -e "< UdpLink Port (random)£OUTBOUND£${udplinkport}+£udp" >> .fn_details_ports
fi
if [ "${engine}" != "unreal" ] && [ "${appid}" != "223250" ]; then
echo "INBOUND GameSpy query port ${gsqueryport} UDP OldQueryPortNumber=${gsqueryport}"
echo -e "> GameSpy query£INBOUND£${gsqueryport}£udp£OldQueryPortNumber=${gsqueryport}" >> .fn_details_ports
fi
if [ "${appid}" == "215360" ]; then
echo "OUTBOUND Master server port 28852 TCP/UDP n/a"
echo -e "< Master server£OUTBOUND£28852£tcp/udp" >> .fn_details_ports
else
echo "OUTBOUND Master server port 28900/28902 TCP/UDP n/a"
echo -e "< Master server£OUTBOUND£28900/28902£tcp/udp" >> .fn_details_ports
fi
if [ "${appid}" ]; then
if [ "${appid}" == "223250" ]; then
echo "OUTBOUND Steam port 20610 UDP n/a"
echo -e "< Steam£OUTBOUND£20610£udp" >> .fn_details_ports
else
echo "OUTBOUND Steam port 20660 UDP n/a"
echo -e "< Steam£OUTBOUND£20660£udp" >> .fn_details_ports
fi
fi
echo "INBOUND WebAdmin ${webadminport} TCP ListenPort=${webadminport}"
echo ""
echo "${servername} WebAdmin"
echo "======================="
echo "WebAdmin URL: http://${ip}:${webadminport}"
echo "WebAdmin Username: ${webadminuser}"
echo "WebAdmin Password: ${webadminpass}"
echo ""
if [ "${pid}" == "0" ]; then
echo -e "Status:\e[0;31m OFFLINE\e[0;39m"
else
echo -e "Status:\e[0;32m ONLINE\e[0;39m"
fi
echo ""
echo -e "> WebAdmin£INBOUND£${webadminport}£tcp£ListenPort=${webadminport}" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
echo -e ""
echo -e "\e[92m${servername} WebAdmin\e[0m"
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' =
echo -e "\e[34mWebAdmin enabled:£\e[0m${webadminenabled}" >> .fn_details_ports
echo -e "\e[34mWebAdmin url:£\e[0mhttp://${ip}:${webadminport}" >> .fn_details_ports
echo -e "\e[34mWebAdmin user:£\e[0m${webadminuser}" >> .fn_details_ports
echo -e "\e[34mWebAdmin password:£\e[0m${webadminpass}" >> .fn_details_ports
column -s '£' -t .fn_details_ports
rm -f .fn_details_ports
fn_details_statusbottom
}
if [ "${engine}" == "avalanche" ]; then
@ -307,5 +397,5 @@ elif [ "${engine}" == "unity3d" ]; then
elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
fn_unrealdetails
else
echo "error: Unable to detect server engine!"
fn_printerrornl "Unable to detect server engine."
fi

59
functions/fn_details_config

@ -0,0 +1,59 @@
#!/bin/bash
# LGSM fn_details_config function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Gets specific details from config files.
if [ "${engine}" == "avalanche" ]; then
servername=$(grep -s Name "${servercfgfullpath}"|sed 's/Name//g' | tr -d '=\"; '|sed 's/,//g')
elif [ "${engine}" == "realvirtuality" ]; then
servername=$(grep -s hostname "${servercfgfullpath}"| grep -v //|sed -e 's/\<hostname\>//g'| tr -d '=\"; ')
port=$(grep -s serverport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
masterport=$(grep -s steamport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
elif [ "${engine}" == "seriousengine35" ]; then
servername=$(grep -s prj_strMultiplayerSessionName "${servercfgfullpath}"|sed 's/prj_strMultiplayerSessionName = //g'|sed 's/"//g'|sed 's/;//g')
rcon=$(grep -s rcts_strAdminPassword "${servercfgfullpath}"|sed 's/rcts_strAdminPassword = //g'|sed 's/"//g'|sed 's/;//g')
port=$(grep -s prj_uwPort "${servercfgfullpath}"|tr -d '\r'|tr -cd [:digit:])
queryport=$((${port} + 1))
elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
servername=$(grep -s hostname "${servercfgfullpath}"|sed 's/hostname //g'|sed 's/"//g')
rcon=$(grep -s rcon_password "${servercfgfullpath}"|sed 's/rcon_password //g'|sed 's/"//g')
elif [ "${engine}" == "spark" ]; then
queryport=$((${port} + 1))
elif [ "${engine}" == "unity3d" ]; then
servername=$(grep ServerName "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
port=$(grep ServerPort "${servercfgfullpath}"|tr -cd [:digit:])
queryport=$((${port} + 1))
webadminenabled=$(grep ControlPanelEnabled "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
webadminport=$(grep ControlPanelPort "${servercfgfullpath}"|tr -cd [:digit:])
webadminpass=$(grep ControlPanelPassword "${servercfgfullpath}"|sed 's/^.*value="//'|cut -f1 -d"\"")
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"\"")
elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
servername=$(grep -s ServerName= ${servercfgfullpath}|sed 's/ServerName=//g')
port=$(grep Port= "${servercfgfullpath}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:])
queryport=$((${port} + 1))
gsqueryport=$(grep OldQueryPortNumber= "${servercfgfullpath}"|tr -d '\r'|tr -cd [:digit:])
udplinkport=$((${port} + 2))
webadminenabled=$(grep bEnabled= "${servercfgfullpath}"|sed 's/bEnabled=//g'|tr -d '\r')
webadminport=$(grep ListenPort= "${servercfgfullpath}"|tr -d '\r'|tr -cd [:digit:])
if [ "${engine}" == "unreal" ]; then
webadminuser=$(grep AdminUsername= "${servercfgfullpath}"|sed 's/\AdminUsername=//g')
webadminpass=$(grep UTServerAdmin.UTServerAdmin "${servercfgfullpath}" -A 2| grep AdminPassword= |sed 's/\AdminPassword=//g')
else
webadminuser=$(grep AdminName= "${servercfgfullpath}"|sed 's/\AdminName=//g')
webadminpass=$(grep AdminPassword= "${servercfgfullpath}"|sed 's/\AdminPassword=//g')
fi
fi

90
functions/fn_details_distro

@ -0,0 +1,90 @@
#!/bin/bash
# LGSM fn_details_distro function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Variables providing useful info on the Operating System such as disk and performace info.
# Used for fn_details, fn_debug and fn_email.
## Distro infomation
# Returns architecture, kernel and distro/os.
arch=$(uname -m)
kernel=$(uname -r)
if [ -f /etc/lsb-release ]; then
os=$(lsb_release -s -d)
elif [ -f /etc/debian_version ]; then
os="Debian $(cat /etc/debian_version)"
elif [ -f /etc/redhat-release ]; then
os=$(cat /etc/redhat-release)
else
os="$(uname -s) $(uname -r)"
fi
# Glibc version number
# e.g: 1.17
glibcv=$(ldd --version |grep ldd|awk '{print $NF}')
# tmux version
# e.g: tmux 1.6
if [ -z $(command -v tmux) ]; then
tmuxv="\e[0;31mNOT INSTALLED!\e[0m"
elif [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:]|tail -c 3)" -lt "16" ]; then
tmuxv="$(tmux -V) (>= 1.6 required for console log)"
else
tmuxv=$(tmux -V)
fi
## Performance
# Average server load
load=$(uptime|awk -F 'load average: ' '{ print $2 }')
# Memory
# Older versions of free do not support -h option.
if [ "$(free -h > /dev/null 2>&1; echo $?)" -ne "0" ]; then
option="-m"
else
option="-h"
fi
physmemtotal=$(free ${option} | grep "Mem:" | awk '{print $2}')
physmemused=$(free ${option} | grep "Mem:" | awk '{print $3}')
physmemfree=$(free ${option} | grep "Mem:" | awk '{print $4}')
swaptotal=$(free ${option} | grep "Swap:" | awk '{print $2}')
swapused=$(free ${option} | grep "Swap:" | awk '{print $3}')
swapfree=$(free ${option} | grep "Swap:" | awk '{print $4}')
# Uptime
uptime=$(</proc/uptime)
uptime=${uptime%%.*}
minutes=$(( uptime/60%60 ))
hours=$(( uptime/60/60%24 ))
days=$(( uptime/60/60/24 ))
# Disk usage
# available space on the partition.
availspace=$(df -hP ${rootdir} | grep -v "Filesystem" | awk '{print $4}')
# used space in serverfiles dir.
serverfilesdu=$(du -sh ${serverfiles} | awk '{print $1}')
if [ -z ${serverfilesdu} ]; then
serverfilesdu="0M"
fi
# Backup info
if [ -d "${backupdir}" ]; then
# used space in backups dir.
backupdirdu=$(du -sh ${backupdir} | awk '{print $1}')
if [ -z ${backupdirdu} ]; then
backupdirdu="0M"
fi
# number of backups.
backupcount=$(find "${backupdir}"/*.tar.gz | wc -l)
# most recent backup.
lastbackup=$(ls -t "${backupdir}"/*.tar.gz | head -1)
# date of most recent backup.
lastbackupdate=$(date -r ${lastbackup})
# size of most recent backup.
lastbackupsize=$(du -h "${lastbackup}" | awk '{print $1}')
fi

44
functions/fn_email

@ -0,0 +1,44 @@
#!/bin/bash
# LGSM fn_email function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Sends email notification if monitor picks up a failure.
local modulename="Email"
fn_printdots "Sending notification to ${email}"
fn_details_distro
{
echo -e "========================================\n${servicename} details\n========================================\n"
echo -e "Service: ${servicename}"
echo -e "Server: ${servername}"
echo -e "Game: ${gamename}"
echo -e "Failure reason: ${failurereason}"
echo -e "Action Taken: ${actiontaken}\n"
echo -e "========================================\nServer details\n========================================\n"
echo -e "Date: $(date)"
echo -e "Distro: ${os}"
echo -e "Arch: ${arch}"
echo -e "Kernel: ${kernel}"
echo -e "Hostname: $HOSTNAME"
echo -e "Uptime: ${days}d, ${hours}h, ${minutes}m"
echo -e "Avg Load${load}\n"
echo -e "========================================\nLogs\n========================================\n"
echo -e "Script log\n===================\n"
fn_details
}|tee "${scriptlogdir}/${servicename}-email.log" > /dev/null 2>&1
tail -25 "${scriptlog}" >> "${emaillog}"
if [ ! -z "${consolelog}" ]; then
echo -e "\n\nConsole log\n====================\n" >> "${emaillog}"
tail -25 "${consolelog}" >> "${emaillog}"
fi
if [ ! -z "${gamelogdir}" ]; then
echo -e "\n\nServer log\n====================\n" >> "${emaillog}"
tail "${gamelogdir}"/*|grep -v "==>"|sed '/^$/d'|tail -25 >> "${emaillog}"
fi
mail -s "${subject}" ${email} < "${emaillog}"
fn_printok "Sending notification to ${email}"
fn_scriptlog "Sent notification to ${email}"
sleep 1
echo -en "\n"

22
functions/fn_email_test

@ -0,0 +1,22 @@
#!/bin/bash
# LGSM fn_email_test function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Sends a test email notification.
local modulename="Email"
fn_check_root
fn_check_systemdir
fn_details_config
if [ "${emailnotification}" = "on" ]; then
fn_scriptlog "Sending test notification"
subject="${servicename} Email Test Notification - Testing ${servername}"
failurereason="Testing ${servicename} email notification"
actiontaken="Sent test email...hello is this thing on?"
fn_email
else
fn_printfailnl "Notifications not enabled"
fn_scriptlog "Notifications not enabled"
fi

122
functions/fn_functions

@ -2,146 +2,144 @@
# LGSM fn_functions function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 150115
# Version: 210115
# Description: Defines all functions to allow download and execution of functions using fn_runfunction.
# This function is called first before any other function. Without this file other functions would not load.
fn_autoip(){
fn_backup(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_backupserver(){
fn_check_ip(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_console(){
fn_check_root(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_debugserver(){
fn_check_steamcmd(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_details(){
fn_check_systemdir(){
functionfile="${FUNCNAME}"
fn_runfunction
}
# Deprecated: fn_distrodetails has replaced this function.
fn_distro(){
fn_check_tmux(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_distrodetails(){
fn_console(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_emailnotification(){
fn_compress_unreal2maps(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_emailtest(){
fn_compress_ut99maps(){
functionfile="${FUNCNAME}"
fn_runfunction
}
# Deprecated: fn_distrodetails has replaced this function.
fn_load(){
fn_csgofix(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_logmanager(){
fn_debug(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_monitorserver(){
fn_details(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_messages(){
fn_details_config(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_restartserver(){
fn_scriptlog "Restarting ${servername}"
fn_stopserver
fn_startserver
}
fn_rootcheck(){
fn_details_distro(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_servername(){
fn_email(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_serverquery(){
fn_email_test(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_startserver(){
fn_getopt(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_stopserver(){
fn_logs(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_syscheck(){
fn_messages(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_tmuxcheck(){
fn_monitor(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_unreal2compressmaps(){
fn_monitor_query(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_ut99compressmaps(){
fn_restart(){
local modulename="Restarting"
fn_details_config
fn_scriptlog "${servername}"
fn_stop
fn_start
}
fn_start(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_updateserver(){
fn_stop(){
functionfile="${FUNCNAME}"
fn_runfunction
}
# Deprecated: fn_distrodetails has replaced this function.
fn_uptime(){
fn_update_dl(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_validateserver(){
fn_validate(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_versioncheck(){
fn_update_check(){
functionfile="${FUNCNAME}"
fn_runfunction
}
@ -155,97 +153,107 @@ autoinstall=1
fn_install
}
fn_csgofix(){
fn_install(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_install_complete(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_install_config(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_getquery(){
fn_install_glibcfix(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_glibcfix(){
fn_install_gsquery(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_header(){
fn_install_header(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_installcomplete(){
fn_install_kffix(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_kffix(){
fn_install_logs(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_loginstall(){
fn_install_retry(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_retryinstall(){
fn_install_rofix(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_rofix(){
fn_install_serverdir(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_serverdirectory(){
fn_install_serverfiles(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_serverconfig(){
fn_install_steamcmd(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_steamdl(){
fn_install_steamfix(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_steamfix(){
fn_install_ut2k4(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_steaminstall(){
fn_install_ut2k4filesdl(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_ut2k4filesdl(){
fn_install_ut2k4fix(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_ut2k4install(){
fn_install_ut2k4key(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_ut2k4fix(){
fn_install_ut99(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_ut99filesdl(){
fn_install_ut99filesdl(){
functionfile="${FUNCNAME}"
fn_runfunction
}
fn_ut99install(){
fn_install_ut99fix(){
functionfile="${FUNCNAME}"
fn_runfunction
}

126
functions/fn_getopt

@ -2,10 +2,11 @@
# LGSM fn_getopt function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 190115
# Version: 210115
# Description: getopt arguments.
fn_getopt_generic(){
case "$getopt" in
start)
fn_start;;
@ -44,4 +45,125 @@ case "$getopt" in
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
exit 1;;
esac
exit
exit
}
fn_getopt_unreal(){
case "$getopt" in
start)
fn_start;;
stop)
fn_stop;;
restart)
fn_restart;;
monitor)
fn_monitor;;
email-test)
fn_email_test;;
details)
fn_details;;
backup)
fn_backup;;
console)
fn_console;;
debug)
fn_debug;;
install)
fn_install;;
map-compressor)
fn_compress_ut99maps;;
*)
echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
exit 1;;
esac
exit
}
fn_getopt_unreal2(){
case "$getopt" in
start)
fn_start;;
stop)
fn_stop;;
restart)
fn_restart;;
update)
norestart=1;
fn_update_check;;
update-restart)
fn_update_check;;
validate)
fn_validate;;
validate-restart)
fn_stop
fn_validate
fn_start;;
monitor)
fn_monitor;;
email-test)
fn_email_test;;
details)
fn_details;;
backup)
fn_backup;;
console)
fn_console;;
debug)
fn_debug;;
install)
fn_install;;
auto-install)
fn_autoinstall;;
map-compressor)
fn_compress_unreal2maps;;
*)
echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install|map-compressor}"
exit 1;;
esac
exit
}
fn_getopt_ut2k4(){
case "$getopt" in
start)
fn_start;;
stop)
fn_stop;;
restart)
fn_restart;;
monitor)
fn_monitor;;
email-test)
fn_email_test;;
details)
fn_details;;
backup)
fn_backup;;
console)
fn_console;;
debug)
fn_debug;;
install)
fn_install;;
map-compressor)
fn_compress_unreal2maps;;
*)
echo "Usage: $0 {start|stop|restart|monitor|email-test|details|backup|console|debug|install|map-compressor}"
exit 1;;
esac
exit
}
if [ "${engine}" == "unreal2" ]; then
if [ "${gamename}" == "Unreal Tournament 2004" ]; then
fn_getopt_ut2k4
else
fn_getopt_unreal2
fi
elif [ "${engine}" == "unreal" ]; then
fn_getopt_unreal
else
fn_getopt_generic
fi

39
functions/fn_install

@ -0,0 +1,39 @@
#!/bin/bash
# LGSM fn_install function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_check_root
fn_install_header
if [ -z "${autoinstall}" ]; then
fn_install_serverdir
fn_install_header
fi
# Download and install
if [ "${gamename}" == "Unreal Tournament 2004" ]; then
fn_install_ut2k4filesdl
fn_install_ut2k4
fn_install_ut2k4key
fi
if [ "${gamename}" == "Unreal Tournament 99" ]; then
fn_install_ut99filesdl
fn_install_ut99
fi
if [ ! -z "${appid}" ]; then
fn_install_steamcmd
fn_install_serverfiles
fn_install_steamfix
fi
# Configuration
fn_install_glibcfix
fn_install_logs
fn_install_gsquery
fn_install_config
if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
fn_csgofix
elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
fn_install_ut2k4fix
fi
fn_install_complete

12
functions/fn_install_complete

@ -0,0 +1,12 @@
#!/bin/bash
# LGSM fn_install_complete function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "================================="
echo "Install Complete!"
echo ""
echo "To start server type:"
echo "${selfname} start"
echo ""

246
functions/fn_install_config

@ -0,0 +1,246 @@
#!/bin/bash
# LGSM fn_server function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_arma3config(){
cp -v lgsm-default.cfg "${servercfgfullpath}"
sleep 1
echo ""
}
fn_goldsourceconfig(){
echo "creating ${servicename}.cfg config file."
cp -v lgsm-default.cfg "${servercfgfullpath}"
sleep 1
echo "creating server.cfg."
touch "${defaultcfg}"
sleep 1
echo "creating redirect."
echo "server.cfg > ${servercfg}."
echo "exec ${servercfg}" > "${defaultcfg}"
echo "creating listip.cfg."
sleep 1
touch "${systemdir}/listip.cfg"
echo "creating banned.cfg."
touch "${systemdir}/banned.cfg"
sleep 1
if [ -z "${autoinstall}" ]; then
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
read -p "Enter server name: " servername
read -p "Enter rcon password: " rconpass
else
servername="${servicename}"
rconpass="rconpassword"
fi
sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}"
sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}"
echo ""
}
fn_jc2config(){
cd "${filesdir}"
cp -v default_config.lua config.lua
sleep 1
echo ""
}
fn_serious3config(){
cp -v lgsm-default.ini ${servercfg}
sleep 1
echo ""
}
fn_sourceconfig(){
echo "creating ${servicename}.cfg config file."
cp -v lgsm-default.cfg "${servercfgfullpath}"
sleep 1
echo "creating server.cfg."
touch "${defaultcfg}"
sleep 1
echo "creating redirect."
echo "server.cfg > ${servercfg}."
echo "exec ${servercfg}" > "${defaultcfg}"
sleep 1
if [ -z "${autoinstall}" ]; then
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
read -p "Enter server name: " servername
read -p "Enter rcon password: " rconpass
else
servername="${servicename}"
rconpass="rconpassword"
fi
sed -i "s/\"hostname\"/\"${servername}\"/g" "${servercfgfullpath}"
sed -i "s/\"rconpassword\"/\"${rconpass}\"/g" "${servercfgfullpath}"
echo ""
}
fn_ut99config(){
echo "${defaultcfg} > ${servercfgfullpath}"
tr -d '\r' < "${defaultcfg}" > "${servercfgfullpath}"
sleep 1
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
echo "enabling WebAdmin."
sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
sleep 1
echo "setting WebAdmin port to 8076."
sed -i '467i\ListenPort=8076' "${servercfgfullpath}"
sleep 1
echo ""
}
fn_unity3dconfig(){
cp -v serverconfig.xml ${servercfg}
sleep 1
echo ""
}
fn_unreal2config(){
cp -v "${defaultcfg}" "${servercfgfullpath}"
sleep 1
echo ""
echo "Configuring ${gamename} Server"
echo "================================="
sleep 1
echo "setting WebAdmin username and password."
sed -i 's/AdminName=/AdminName=admin/g' "${servercfgfullpath}"
sed -i 's/AdminPassword=/AdminPassword=admin/g' "${servercfgfullpath}"
sleep 1
echo "enabling WebAdmin."
sed -i 's/bEnabled=False/bEnabled=True/g' "${servercfgfullpath}"
if [ "${gamename}" == "Unreal Tournament 2004" ]; then
sleep 1
echo "setting WebAdmin port to 8075."
sed -i 's/ListenPort=80/ListenPort=8075/g' "${servercfgfullpath}"
fi
sleep 1
echo ""
}
echo ""
echo "Creating Configs"
echo "================================="
sleep 1
cd "${servercfgdir}"
if [ "${gamename}" == "7 Days To Die" ]; then
fn_unity3dconfig
elif [ "${gamename}" == "ARMA 3" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Arma3/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_arma3config
elif [ "${gamename}" == "Blade Symphony" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/BladeSymphony/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_goldsourceconfig
elif [ "${gamename}" == "Counter Strike 1.6" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrike/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_goldsourceconfig
elif [ "${gamename}" == "Counter Strike: Condition Zero" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeConditionZero/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_goldsourceconfig
elif [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeGlobalOffensive/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Counter Strike: Source" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/CounterStrikeSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Day of Defeat" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/DayOfDefeat/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_goldsourceconfig
elif [ "${gamename}" == "Day of Defeat: Source" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/DayOfDefeatSource/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Fistful of Frags" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/FistfulOfFrags/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Garrys's Mod" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/GarrysMod/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Half Life 2: Deathmatch" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/HalfLife2Deathmatch/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Half Life: Deathmatch Classic" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/HalfLifeDeathmatchClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_goldsourceconfig
elif [ "${gamename}" == "Insurgency" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Insurgency/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Just Cause 2" ]; then
fn_jc2config
elif [ "${gamename}" == "Killing Floor" ]; then
fn_unreal2config
elif [ "${gamename}" == "Left 4 Dead" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Left4Dead/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Left 4 Dead 2" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/Left4Dead2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "No More Room in Hell" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/NoMoreRoomInHell/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Natural Selection 2" ]; then
echo -e "no configs required."
sleep 1
echo ""
elif [ "${gamename}" == "Red Orchestra: Ostfront 41-45" ]; then
fn_unreal2config
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
echo -e "downloading lgsm-default.ini...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/SeriousSam3BFE/cfg/lgsm-default.ini 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_serious3config
elif [ "${gamename}" == "Team Fortress 2" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/TeamFortress2/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_sourceconfig
elif [ "${gamename}" == "Team Fortress Classic" ]; then
echo -e "downloading lgsm-default.cfg...\c"
wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/TeamFortressClassic/cfg/lgsm-default.cfg 2>&1 | grep -F HTTP | cut -c45- | uniq
sleep 1
fn_goldsourceconfig
elif [ "${gamename}" == "Unreal Tournament 2004" ]; then
fn_unreal2config
elif [ "${gamename}" == "Unreal Tournament 99" ]; then
fn_ut99config
fi

116
functions/fn_install_glibcfix

@ -0,0 +1,116 @@
#!/bin/bash
# LGSM fn_install_glibcfix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_glibcfixmsg(){
echo ""
echo "GLIBC Fix required"
echo "============================"
sleep 1
fn_printwarningnl "${gamename} requires GLIBC_${glibcversion} or above"
sleep 1
echo ""
echo -e "Currently installed:\e[0;31m GLIBC_$(ldd --version |grep ldd|awk '{print $NF}')\e[0;39m"
echo -e "Required: =>\e[0;32m GLIBC_${glibcversion}\e[0;39m"
echo ""
sleep 1
echo "The installer will now detect and download the required files to allow ${gamename} server to run on a distro with less than GLIBC_${glibcversion}."
echo "note: This will NOT upgrade GLIBC on your system."
sleep 1
echo ""
echo -en "loading required files.\r"
sleep 1
echo -en "loading required files..\r"
sleep 1
echo -en "loading required files...\r"
sleep 1
echo -en "\n"
}
# if ldd command not detected
if [ -z $(command -v ldd) ]; then
echo ""
fn_printfailurenl "GLIBC is not detected"
sleep 1
echo "Install GLIBC and retry installation."
sleep 1
echo ""
while true; do
read -p "Continue install? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
done
# if Glibc less than 1.15
elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 215 ]; then
# Blade Symphony
if [ "${gamename}" == "Blade Symphony" ]; then
glibcversion="2.15"
fn_glibcfixmsg
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
# Fistful of Frags
elif [ "${gamename}" == "Fistful of Frags" ]; then
glibcversion="2.15"
fn_glibcfixmsg
cd "${filesdir}"
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/FistfulOfFrags/dependencies/libm.so.6
# Garrys's Mod
elif [ "${gamename}" == "Garrys's Mod" ]; then
glibcversion="2.15"
fn_glibcfixmsg
cd "${filesdir}/bin"
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libc.so.6
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libm.so.6
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/GarrysMod/dependencies/libpthread.so.0
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
# Insurgency
elif [ "${gamename}" == "Insurgency" ]; then
glibcversion="2.15"
fn_glibcfixmsg
cd "${filesdir}/bin"
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libc.so.6
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/librt.so.1
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libpthread.so.0
# Natural Selection 2
elif [ "${gamename}" == "Natural Selection 2" ]; then
glibcversion="2.15"
fn_glibcfixmsg
cd "${filesdir}"
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NaturalSelection2/dependencies/libm.so.6
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
# No More Room in Hell
elif [ "${gamename}" == "No More Room in Hell" ]; then
glibcversion="2.15"
fn_glibcfixmsg
cd "${filesdir}"
wget -nv -N --no-check-certificate https://github.com/dgibbs64/linuxgameservers/raw/master/NoMoreRoomInHell/dependencies/libm.so.6
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
# if Glibc less than 1.13
elif [ "$(ldd --version | sed -n '1 p' | tr -cd [:digit:] | tail -c 3)" -lt 213 ]; then
# ARMA 3
if [ "${gamename}" == "ARMA 3" ]; then
glibcversion="2.13"
fn_glibcfixmsg
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
# Just Cause 2
elif [ "${gamename}" == "Just Cause 2" ]; then
glibcversion="2.13"
fn_glibcfixmsg
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/libstdc++.so.6"
# Serious Sam 3: BFE
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
glibcversion="2.13"
fn_glibcfixmsg
cp -v "${rootdir}/steamcmd/linux32/libstdc++.so.6" "${filesdir}/Bin/libstdc++.so.6"
else
: # Else glibcfix not required.
fi
else
: #Else glibcfix not required.
fi
fi
sleep 1

30
functions/fn_install_gsquery

@ -0,0 +1,30 @@
#!/bin/bash
# LGSM fn_install_gsquery function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_dlgsquery(){
cd "${rootdir}"
echo -e "downloading gsquery.py...\c"
wget -N --no-check-certificate /dev/null "http://danielgibbs.co.uk/dl/gsquery.py" 2>&1 | grep -F "HTTP" | grep -v "Moved Permanently" | cut -c45- | uniq
chmod +x gsquery.py
}
if [ "${engine}" == "avalanche" ]||[ "${engine}" == "goldsource" ]||[ "${engine}" == "realvirtuality" ]||[ "${engine}" == "source" ]||[ "${engine}" == "spark" ]||[ "${engine}" == "unity3d" ]||[ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]||[ "${engine}" == "unreal2" ]; then
echo ""
echo "GameServerQuery"
echo "============================"
if [ -z ${autoinstall} ]; then
while true; do
read -p "Do you want to install GameServerQuery? [y/N]" yn
case $yn in
[Yy]* ) fn_dlgsquery;break;;
[Nn]* ) echo ""; echo "Not installing GameServerQuery.";break;;
* ) echo "Please answer yes or no.";;
esac
done
else
fn_dlgsquery
fi
fi

18
functions/fn_install_header

@ -0,0 +1,18 @@
#!/bin/bash
# LGSM fn_install_header function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
clear
echo "================================="
echo "${gamename}"
echo "Linux Game Server Manager"
echo "by Daniel Gibbs"
if [ "${gamename}" == "ARMA 3" ]; then
echo "contributions by Scarsz"
elif [ "${gamename}" == "Left 4 Dead" ]; then
echo "contributions by Summit Singh Thakur"
fi
echo "http://danielgibbs.co.uk"
echo "================================="

27
functions/fn_install_kffix

@ -0,0 +1,27 @@
#!/bin/bash
# LGSM fn_install_kffix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Applying ${gamename} Server Fixes"
echo "================================="
echo "Applying WebAdmin ROOst.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ROOst.css"
sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css"
sleep 1
echo "Applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
sleep 1
echo "applying server name fix."
sleep 1
echo "forcing server restart..."
sleep 1
cd "${rootdir}"
${selfname} start
sleep 5
${selfname} restart
sleep 5
${selfname} stop

42
functions/fn_install_logs

@ -0,0 +1,42 @@
#!/bin/bash
# LGSM fn_install_logs function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo ""
echo "Creating log directorys"
echo "================================="
sleep 1
# Create dir's for the script and console logs
mkdir -v "${rootdir}/log"
mkdir -v "${scriptlogdir}"
touch "${scriptlog}"
mkdir -v "${consolelogdir}"
touch "${consolelog}"
# If a server is source or goldsource create a symbolic link to the game server logs
if [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
if [ ! -h "${rootdir}/log/server" ]; then
ln -sv "${gamelogdir}" "${rootdir}/log/server"
else
echo "Symbolic link ${gamelogdir} => ${rootdir}/log/server already exists!"
fi
fi
# If a server is unreal2 or unity3d create a dir
if [ "${engine}" == "unreal2" ]||[ "${engine}" == "unity3d" ]; then
mkdir -pv "${gamelogdir}"
fi
if [ "${gamename}" == "7 Days To Die" ]; then
if [ ! -h "${gamelogdir}/output_log.txt" ]; then
ln -sv "${filesdir}/7DaysToDie_Data/output_log.txt" "${gamelogdir}/output_log.txt"
fi
fi
# If server uses SteamCMD create a symbolic link to the Steam logs
if [ -d "${rootdir}/Steam/logs" ]; then
if [ ! -h "${rootdir}/log/steamcmd" ]; then
ln -sv "${rootdir}/Steam/logs" "${rootdir}/log/steamcmd"
else
echo "Symbolic link ${rootdir}/Steam/logs => ${rootdir}/log/steamcmd already exists!"
fi
fi
sleep 1

14
functions/fn_install_retry

@ -0,0 +1,14 @@
#!/bin/bash
# LGSM fn_install_retry function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
while true; do
read -p "Retry install? [y/N]" yn
case $yn in
[Yy]* ) fn_install; exit;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
done

27
functions/fn_install_rofix

@ -0,0 +1,27 @@
#!/bin/bash
# LGSM fn_install_rofix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Applying ${gamename} Server Fixes"
echo "================================="
echo "Applying WebAdmin ROOst.css fix!"
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ROOst.css"
sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ROOst.css"
sleep 1
echo "Applying WebAdmin CharSet fix!"
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/uweb.int"
sleep 1
echo "applying server name fix."
sleep 1
echo "forcing server restart..."
sleep 1
cd "${rootdir}"
${selfname} start
sleep 5
${selfname} restart
sleep 5
${selfname} stop

23
functions/fn_install_serverdir

@ -0,0 +1,23 @@
#!/bin/bash
# LGSM fn_install_serverdir function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo ""
echo "Server Directory"
echo "================================="
echo ""
pwd
echo ""
if [ -d "${filesdir}" ]; then
fn_printwarningnl "A server is already installed here."
fi
while true; do
read -p "Continue [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo Exiting; return 1;;
* ) echo "Please answer yes or no.";;
esac
done

72
functions/fn_install_serverfiles

@ -0,0 +1,72 @@
#!/bin/bash
# LGSM fn_install_serverfiles function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_steaminstallcommand(){
counter="0"
while [ "${counter}" == "0" ]||[ "$(grep -wc 0x402 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x406 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x6 .fn_install_serverfiles.tmp)" -ge "1" ]||[ "$(grep -wc 0x106 .fn_install_serverfiles.tmp)" -ge "1" ]; do
counter=$((counter+1))
if [ "${counter}" -le "10" ]; then
# Attempt 1-4: Standard attempt
# Attempt 5-6: Validate attempt
# Attempt 7-8: Validate, delete long name dir
# Attempt 9-10: Validate, delete long name dir, re-download SteamCMD
# Attempt 11: Failure
if [ "${counter}" -ge "2" ]; then
fn_printwarningnl "SteamCMD did not complete the download, retrying: Attempt ${counter}:"
fi
if [ "${counter}" -ge "7" ]; then
echo "Removing $(find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$')"
find ${filesdir} -type d -print0 | grep -Ez '[^/]{30}$' | xargs -0 rm -rf
fi
if [ "${counter}" -ge "9" ]; then
rm -rf "${rootdir}/steamcmd"
fn_check_steamcmd
fi
if [ "${counter}" -le "4" ]; then
./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit |tee .fn_install_serverfiles.tmp
elif [ "${counter}" -ge "5" ]; then
./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp
fi
elif [ "${counter}" -ge "11" ]; then
fn_printfailurenl "SteamCMD did not complete the download, too many retrys"
break
fi
done
# Goldsource servers commonly fail to download all the server files required.
# Validating a few of times may reduce the chance of this issue.
if [ "${engine}" == "goldsource" ]; then
counter="0"
while [ "${counter}" -le "4" ]; do
counter=$((counter+1))
./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" -validate +quit |tee .fn_install_serverfiles.tmp
done
fi
rm -f .fn_install_serverfiles.tmp
}
echo ""
echo "Installing ${gamename} Server"
echo "================================="
sleep 1
mkdir -pv "${filesdir}"
cd "${rootdir}/steamcmd"
fn_steaminstallcommand
if [ -z "${autoinstall}" ]; then
echo ""
echo "================================="
while true; do
read -p "Was the install successful? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) fn_install_retry;;
* ) echo "Please answer yes or no.";;
esac
done
fi

26
functions/fn_install_steamcmd

@ -0,0 +1,26 @@
#!/bin/bash
# LGSM fn_check_steamcmd function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Downloads SteamCMD on install and checks if missing before running functions that require SteamCMD
echo ""
echo "Installing SteamCMD"
echo "================================="
cd "${rootdir}"
mkdir -pv "steamcmd"
sleep 1
cd "steamcmd"
if [ ! -f steamcmd.sh ]; then
echo -e "downloading steamcmd_linux.tar.gz...\c"
wget -N --no-check-certificate /dev/null http://media.steampowered.com/client/steamcmd_linux.tar.gz 2>&1 | grep -F HTTP | cut -c45-| uniq
tar --verbose -zxf steamcmd_linux.tar.gz
rm -v steamcmd_linux.tar.gz
chmod +x steamcmd.sh
sleep 1
else
echo "Steam already installed!"
fi
sleep 1

38
functions/fn_install_steamfix

@ -0,0 +1,38 @@
#!/bin/bash
# LGSM fn_install_steamfix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
fn_steamclientfix(){
echo ""
echo "Applying steamclient.so fix"
echo "================================="
sleep 1
mkdir -pv "${HOME}/.steam"
mkdir -pv "${HOME}/.steam/sdk32"
cp -v "${rootdir}/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so"
sleep 1
}
# Gary's Mod Specific
fn_libsteamfix(){
echo ""
echo "Applying libsteam.so fix"
echo "================================="
sleep 1
mkdir -pv "${HOME}/.steam"
mkdir -pv "${HOME}/.steam/sdk32"
if [ "${gamename}" == "Garrys's Mod" ]; then
cp -v "${filesdir}/bin/libsteam.so" "${HOME}/.steam/sdk32/libsteam.so"
elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
mkdir "${HOME}/.steam/bin32"
cp -v "${filesdir}/Bin/libsteam.so" "${HOME}/.steam/bin32/libsteam.so"
fi
sleep 1
}
fn_steamclientfix
if [ "${gamename}" == "Garrys's Mod" ]||[ "${gamename}" == "Serious Sam 3: BFE" ]; then
fn_libsteamfix
fi

42
functions/fn_install_ut2k4

@ -0,0 +1,42 @@
#!/bin/bash
# LGSM fn_install_ut2k4 function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Installing ${gamename} Server"
echo "================================="
sleep 1
mkdir -pv "${filesdir}"
cd "${filesdir}"
echo "Extracting dedicatedserver3339-bonuspack.zip"
sleep 1
unzip dedicatedserver3339-bonuspack.zip
echo "Extracting ut2004-lnxpatch3369-2.tar.bz2"
sleep 1
tar -xvjf ut2004-lnxpatch3369-2.tar.bz2 UT2004-Patch/ --strip-components=1
while true; do
read -p "Was the install successful? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) fn_install_retry;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Remove ut2004-lnxpatch3369-2.tar.bz2? [y/N]" yn
case $yn in
[Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Remove dedicatedserver3339-bonuspack.zip? [y/N]" yn
case $yn in
[Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
echo ""

54
functions/fn_install_ut2k4filesdl

@ -0,0 +1,54 @@
#!/bin/bash
# LGSM fn_install_ut2k4filesdl function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Downloading Server Files"
echo "================================="
cd "${rootdir}"
mkdir -pv "${filesdir}"
cd "${filesdir}"
if [ ! -f dedicatedserver3339-bonuspack.zip ]; then
wget http://danielgibbs.co.uk/wp-content/uploads/ut2004/dedicatedserver3339-bonuspack.zip
else
echo "dedicatedserver3339-bonuspack.zip already downloaded!"
fi
echo "Running MD5 checksum to verify the file"
sleep 1
echo "MD5 checksum: d3f28c5245c4c02802d48e4f0ffd3e34"
md5check=$(md5sum dedicatedserver3339-bonuspack.zip|awk '{print $1;}')
echo "File returned: ${md5check}"
if [ "${md5check}" != "d3f28c5245c4c02802d48e4f0ffd3e34" ]; then
echo "MD5 checksum: FAILED!"
read -p "Retry download? [y/N]" yn
case $yn in
[Yy]* ) rm -fv dedicatedserver3339-bonuspack.zip; fn_install_ut2k4filesdl;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
else
echo "MD5 checksum: PASSED"
fi
if [ ! -f ut2004-lnxpatch3369-2.tar.bz2 ]; then
wget http://danielgibbs.co.uk/wp-content/uploads/ut2004/ut2004-lnxpatch3369-2.tar.bz2
else
echo "ut2004-lnxpatch3369-2.tar.bz2 already downloaded!"
fi
echo "Running MD5 checksum to verify the file"
sleep 1
echo "MD5 checksum: 0fa447e05fe5a38e0e32adf171be405e"
md5check=$(md5sum ut2004-lnxpatch3369-2.tar.bz2|awk '{print $1;}')
echo "File returned: ${md5check}"
if [ "${md5check}" != "0fa447e05fe5a38e0e32adf171be405e" ]; then
echo "MD5 checksum: FAILED!"
read -p "Retry download? [y/N]" yn
case $yn in
[Yy]* ) rm -fv ut2004-lnxpatch3369-2.tar.bz2; fn_install_ut2k4filesdl;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
else
echo "MD5 checksum: PASSED"
fi
echo ""

32
functions/fn_install_ut2k4fix

@ -0,0 +1,32 @@
#!/bin/bash
# LGSM fn_install_ut2k4fix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Applying ${gamename} Server Fixes"
echo "================================="
echo "applying WebAdmin ut2003.css fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=585435&postcount=13"
sed -i 's/none}/none;/g' "${filesdir}/Web/ServerAdmin/ut2003.css"
sed -i 's/underline}/underline;/g' "${filesdir}/Web/ServerAdmin/ut2003.css"
sleep 1
echo "applying WebAdmin CharSet fix."
echo "http://forums.tripwireinteractive.com/showpost.php?p=442340&postcount=1"
sed -i 's/CharSet="iso-8859-1"/CharSet="utf-8"/g' "${systemdir}/UWeb.int"
sleep 1
echo ""
echo -en "forcing server restart.\r"
sleep 0.5
echo -en "forcing server restart..\r"
sleep 0.5
echo -en "forcing server restart...\r"
sleep 0.5
echo -en "\n"
sleep 0.5
cd "${rootdir}"
${selfname} start
sleep 5
${selfname} restart
sleep 5
${selfname} stop

18
functions/fn_install_ut2k4key

@ -0,0 +1,18 @@
#!/bin/bash
# LGSM fn_install_ut2k4key function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Enter ${gamename} CD Key"
echo "================================="
sleep 1
echo "To get your server listed on the Master Server list"
echo "you must get a free CD key. Get a key here:"
echo "http://www.unrealtournament.com/ut2004server/cdkey.php"
echo ""
echo "Once you have the key enter it below"
echo -n "KEY: "
read CODE
echo ""\""CDKey"\""="\""${CODE}"\""" > "${systemdir}/cdkey"
echo ""

42
functions/fn_install_ut99

@ -0,0 +1,42 @@
#!/bin/bash
# LGSM fn_install_ut99 function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Installing ${gamename} Server"
echo "================================="
sleep 1
mkdir -pv "${filesdir}"
cd "${filesdir}"
echo "Extracting ut-server-436.tar.gz"
sleep 1
tar -zxvf ut-server-436.tar.gz ut-server/ --strip-components=1
echo "Extracting UTPGPatch451.tar.bz2"
sleep 1
tar -jxvf UTPGPatch451.tar.bz2
while true; do
read -p "Was the install successful? [y/N]" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) fn_install_retry;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Remove ut-server-436.tar.gz? [y/N]" yn
case $yn in
[Yy]* ) rm -fv ut-server-436.tar.gz; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
while true; do
read -p "Remove UTPGPatch451.tar.bz2? [y/N]" yn
case $yn in
[Yy]* ) rm -fv UTPGPatch451.tar.bz2; break;;
[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done
echo ""

54
functions/fn_install_ut99filesdl

@ -0,0 +1,54 @@
#!/bin/bash
# LGSM fn_install_ut99filesdl function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Downloading Server Files"
echo "================================="
cd "${rootdir}"
mkdir -pv "${filesdir}"
cd "${filesdir}"
if [ ! -f ut-server-436.tar.gz ]; then
wget http://danielgibbs.co.uk/wp-content/uploads/ut-server-436.tar.gz
else
echo "ut-server-436.tar.gz already downloaded!"
fi
echo "Running MD5 checksum to verify the file"
sleep 1
echo "MD5 checksum: 10cd7353aa9d758a075c600a6dd193fd"
md5check=$(md5sum ut-server-436.tar.gz|awk '{print $1;}')
echo "File returned: ${md5check}"
if [ "${md5check}" != "10cd7353aa9d758a075c600a6dd193fd" ]; then
echo "MD5 checksum: FAILED!"
read -p "Retry download? [y/N]" yn
case $yn in
[Yy]* ) rm -fv ut-server-436.tar.gz; fn_filesdl;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
else
echo "MD5 checksum: PASSED"
fi
if [ ! -f UTPGPatch451.tar.bz2 ]; then
wget http://danielgibbs.co.uk/wp-content/uploads/UTPGPatch451.tar.bz2
else
echo "UTPGPatch451.tar.bz2 already downloaded!"
fi
echo "Running MD5 checksum to verify the file"
sleep 1
echo "MD5 checksum: 77a735a78b1eb819042338859900b83b"
md5check=$(md5sum UTPGPatch451.tar.bz2|awk '{print $1;}')
echo "File returned: ${md5check}"
if [ "${md5check}" != "77a735a78b1eb819042338859900b83b" ]; then
echo "MD5 checksum: FAILED!"
read -p "Retry download? [y/N]" yn
case $yn in
[Yy]* ) rm -fv UTPGPatch451.tar.bz2; fn_filesdl;;
[Nn]* ) echo Exiting; exit;;
* ) echo "Please answer yes or no.";;
esac
else
echo "MD5 checksum: PASSED"
fi
echo ""

24
functions/fn_install_ut99fix

@ -0,0 +1,24 @@
#!/bin/bash
# LGSM fn_install_ut99fix function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
echo "Applying ${gamename} Server Fixes"
echo "================================="
echo "enabling UdpServerUplink."
{
echo "[IpServer.UdpServerUplink]"
echo "DoUplink=True"
echo "UpdateMinutes=1"
echo "MasterServerAddress=unreal.epicgames.com"
echo "MasterServerPort=27900"
echo "Region=0"
}|tee -a "${servercfgfullpath}" > /dev/null 2>&1
sleep 1
echo "removing dead mplayer.com master server."
sed -i '/master.mplayer.com/d' "${servercfgfullpath}"
sleep 1
echo "inserting qtracker.com master server."
sed -i '66i\ServerActors=IpServer.UdpServerUplink MasterServerAddress=master.qtracker.com MasterServerPort=27900' "${servercfgfullpath}"
echo ""

50
functions/fn_logs

@ -0,0 +1,50 @@
#!/bin/bash
# LGSM fn_logs function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Acts as a log rotater, removing old logs.
local modulename="Log Manager"
if [ ! -e "${consolelog}" ]; then
touch "${consolelog}"
fi
# log manager will active if finds logs older than ${logdays}
if [ $(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l) -ne "0" ]; then
fn_printdots "Starting"
sleep 1
fn_printok "Starting"
fn_scriptlog "Starting"
sleep 1
echo -en "\n"
fn_printinfo "Removing logs older than ${logdays} days"
fn_scriptlog "Removing logs older than ${logdays} days"
sleep 1
echo -en "\n"
if [ "${engine}" == "unreal2" ]; then
find "${gamelogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}"
fi
find "${scriptlogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}"
find "${consolelogdir}"/* -mtime +${logdays}|tee >> "${scriptlog}"
if [ "${engine}" == "unreal2" ]; then
gamecount=$(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l)
fi
scriptcount=$(find "${scriptlogdir}"/* -mtime +${logdays}|wc -l)
consolecount=$(find "${consolelogdir}"/* -mtime +${logdays}|wc -l)
count=$((${scriptcount} + ${consolecount}))
if [ "${engine}" == "unreal2" ]; then
count=$((${scriptcount} + ${consolecount} + ${gamecount}))
else
count=$((${scriptcount} + ${consolecount}))
fi
if [ "${engine}" == "unreal2" ]; then
find "${gamelogdir}"/* -mtime +${logdays} -exec rm {} \;
fi
find "${scriptlogdir}"/* -mtime +${logdays} -exec rm {} \;
find "${consolelogdir}"/* -mtime +${logdays} -exec rm {} \;
fn_printok "Removed ${count} log files"
fn_scriptlog "Removed ${count} log files"
sleep 1
echo -en "\n"
fi

11
functions/fn_messages

@ -2,7 +2,7 @@
# LGSM fn_messages function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 010115
# Version: 210115
# Description: Defines on-screen messages such as [ OK ] and how script logs look.
@ -117,4 +117,13 @@ fn_printfailure(){
fn_printfailurenl(){
echo -e "\e[0;31mFailure!\e[0m $@"
}
# Error!
fn_printerror(){
echo -en "\e[0;31mError!\e[0m $@"
}
fn_printerrornl(){
echo -e "\e[0;31mError!\e[0m $@"
}

60
functions/fn_monitor

@ -0,0 +1,60 @@
#!/bin/bash
# LGSM fn_monitor function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Monitors server by checking for running proccesses
# then passes to fn_monitor_query.
local modulename="Monitor"
fn_check_root
fn_check_systemdir
fn_check_ip
fn_details_config
fn_printdots "${servername}"
fn_scriptlog "${servername}"
sleep 1
if [ ! -f "${lockselfname}" ]; then
fn_printinfo "Disabled: No lock file found"
fn_scriptlog "Disabled: No lock file found"
sleep 1
echo -en "\n"
echo "To enable monitor run ${selfname} start"
exit
fi
updatecheck=$(ps -ef|grep "${selfname} update"|grep -v grep|wc -l)
if [ "${updatecheck}" = "0" ]; then
fn_printdots "Checking session: CHECKING"
fn_scriptlog "Checking session: CHECKING"
sleep 1
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -E "^${servicename}:"|wc -l)
if [ "${tmuxwc}" -eq 1 ]; then
fn_printok "Checking session: OK"
fn_scriptlog "Checking session: OK"
sleep 1
echo -en "\n"
fn_monitor_query
exit
else
fn_printfail "Checking session: FAIL"
fn_scriptlog "Checking session: FAIL"
sleep 1
echo -en "\n"
if [ "${emailnotification}" = "on" ]; then
subject="${servicename} Monitor - Starting ${servername}"
failurereason="${servicename} process not running"
actiontaken="${servicename} has been restarted"
fn_email
fi
fn_scriptlog "Monitor is starting ${servername}"
fn_start
fi
else
fn_printinfonl "SteamCMD is currently checking for updates"
fn_scriptlog "SteamCMD is currently checking for updates"
sleep 1
fn_printinfonl "When update is complete ${servicename} will start"
fn_scriptlog "When update is complete ${servicename} will start"
sleep 1
fi

85
functions/fn_monitor_query

@ -0,0 +1,85 @@
#!/bin/bash
# LGSM fn_monitor_query function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: uses gsquery.py to directly query the server.
# Detects if the server has frozen.
local modulename="Monitor"
if [ -f gsquery.py ]; then
if [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
gameport=$(grep Port= "${servercfgfullpath}"|grep -v Master|grep -v LAN|grep -v Proxy|grep -v Listen|tr -d '\r'|tr -cd [:digit:])
port=$((${gameport} + 1))
elif [ "${engine}" == "spark" ]; then
port=$((${port} + 1))
elif [ "${engine}" == "realvirtuality" ]; then
queryport=$(grep -s steamqueryport= "${servercfgfullpath}"|grep -v //|tr -d '\r'|tr -cd [:digit:])
port=${queryport}
elif [ "${engine}" == "unity3d" ]; then
gameport=$(grep ServerPort "${servercfgfullpath}"|tr -cd [:digit:])
port=$((${gameport} + 1))
fi
fn_printinfo "Detected gsquery.py"
fn_scriptlog "Detected gsquery.py"
sleep 1
fn_printdots "Querying port: ${ip}:${port} : QUERYING"
fn_scriptlog "Querying port: ${ip}:${port} : QUERYING"
sleep 1
serverquery=$(./gsquery.py -a ${ip} -p ${port} -e ${engine} 2>&1)
exitcode=$?
if [ "${exitcode}" == "1" ]||[ "${exitcode}" == "2" ]||[ "${exitcode}" == "3" ]||[ "${exitcode}" == "4" ]; then
fn_printfail "Querying port: ${ip}:${port} : ${serverquery}"
fn_scriptlog "Querying port: ${ip}:${port} : ${serverquery}"
sleep 1
echo -en "\n"
if [[ -z "${secondquery}" ]]; then
fn_printinfo "Waiting 30 seconds to re-query"
fn_scriptlog "Waiting 30 seconds to re-query"
sleep 30
secondquery=1
fn_monitor_query
fi
if [ "${emailnotification}" = "on" ]; then
fn_details_config
subject="${servicename} Monitor - Starting ${servername}"
failurereason="Failed to query ${servicename}: ${serverquery}"
actiontaken="restarted ${servicename}"
fn_email
fi
fn_restart
exit
elif [ "${exitcode}" == "0" ]; then
fn_printok "Querying port: ${ip}:${port} : OK"
fn_scriptlog "Querying port: ${ip}:${port} : OK"
sleep 1
echo -en "\n"
exit
elif [ "${exitcode}" == "126" ]; then
fn_printfail "Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied"
fn_scriptlog "Querying port: ${ip}:${port} : ERROR: ./gsquery.py: Permission denied"
sleep 1
echo -en "\n"
echo "Attempting to resolve automatically"
chmod +x -v gsquery.py
exitcode=$?
if [ "${exitcode}" == "0" ]; then
fn_monitor_query
else
fn_printfailure "Unable to resolve automatically. Please manually fix permissions.\n"
owner=$(ls -al gsquery.py|awk '{ print $3 }')
echo "As user ${owner} or root run the following command."
whoami=$(whoami)
echo -en "\nchown ${whoami}:${whoami} gsquery.py\n\n"
exit
fi
else
fn_printfail "Querying port: ${ip}:${port} : UNKNOWN ERROR"
fn_scriptlog "Querying port: ${ip}:${port} : UNKNOWN ERROR"
sleep 1
echo -en "\n"
./gsquery.py -a ${ip} -p ${port} -e ${engine}
exit
fi
fi

69
functions/fn_start

@ -0,0 +1,69 @@
#!/bin/bash
# LGSM fn_start function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Starts the server.
local modulename="Starting"
fn_check_root
fn_check_systemdir
fn_check_ip
if [ "${gamename}" == "Counter Strike: Global Offensive" ]; then
startfix=1
fn_csgofix
fi
fn_details_config
fn_parms
fn_logs
fn_printdots "${servername}"
fn_scriptlog "${servername}"
sleep 1
fn_check_tmux
fn_check_steamcmd
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -v failed|grep -Ec "^${servicename}:")
if [ "${tmuxwc}" -eq 0 ]; then
fn_scriptlog "Rotating log files"
if [ "${engine}" == "unreal2" ]; then
mv "${gamelog}" "${gamelogdate}"
fi
mv "${scriptlog}" "${scriptlogdate}"
mv "${consolelog}" "${consolelogdate}"
fi
if [ "${tmuxwc}" -eq 1 ]; then
fn_printinfo "${servername} is already running"
fn_scriptlog "${servername} is already running"
sleep 1
echo -en "\n"
exit
fi
# Create lock file
date > "${rootdir}/${lockselfname}"
cd "${executabledir}"
tmux new-session -d -s ${servicename} "${executable} ${parms}" 2> "${scriptlogdir}/.${servicename}-tmux-error.tmp"
# tmux pipe-pane not supported in tmux versions < 1.6
if [ "$(tmux -V|sed "s/tmux //"|sed -n '1 p'|tr -cd [:digit:]|tail -c 3)" -lt "16" ]; then
echo "Console logging disabled: Tmux => 1.6 required" >> "${consolelog}"
echo "Currently installed: $(tmux -V)" >> "${consolelog}"
else
tmux pipe-pane -o -t ${servicename} "exec cat >> '${consolelog}'"
fi
sleep 1
tmuxwc=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
if [ "${tmuxwc}" -eq 0 ]; then
fn_printfailnl "Unable to start ${servername}"
fn_scriptlog "Unable to start ${servername}"
echo -en " Check log files: ${rootdir}/log"
if [ -s "${scriptlogdir}/.${servicename}-tmux-error.tmp" ]; then
fn_scriptlog "tmux returned the following error"
cat "${scriptlogdir}/.${servicename}-tmux-error.tmp" >> "${scriptlog}"
fi
else
fn_printok "${servername}"
fn_scriptlog "Started ${servername}"
fi
rm "${scriptlogdir}/.${servicename}-tmux-error.tmp"
sleep 1
echo -en "\n"

29
functions/fn_stop

@ -0,0 +1,29 @@
#!/bin/bash
# LGSM fn_stop function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Stops the server.
local modulename="Stopping"
fn_check_root
fn_check_systemdir
fn_details_config
fn_printdots "${servername}"
fn_scriptlog "${servername}"
sleep 1
fn_check_tmux
pid=$(tmux list-sessions 2>&1|awk '{print $1}'|grep -Ec "^${servicename}:")
if [ "${pid}" == "0" ]; then
fn_printfail "${servername} is already stopped"
fn_scriptlog "${servername} is already stopped"
else
tmux kill-session -t ${servicename}
fn_printok "${servername}"
fn_scriptlog "Stopped ${servername}"
fi
# Remove lock file
rm -f "${lockselfname}"
sleep 1
echo -en "\n"

189
functions/fn_update_check

@ -0,0 +1,189 @@
#!/bin/bash
# LGSM fn_update_check function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Checks if a server update is available.
local modulename="Update"
fn_steamcmdcheck(){
# Checks for server update from SteamCMD
fn_printdots "Checking for update: SteamCMD"
fn_scriptlog "Checking for update: SteamCMD"
sleep 1
currentbuild=$(grep buildid "${appmanifestfile}" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
cd "${rootdir}/steamcmd"
availablebuild=$(./steamcmd.sh +login "${steamuser}" "${steampass}" +app_info_print ${appid} +app_info_print ${appid} +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3)
if [ -z "${availablebuild}" ]; then
fn_printfail "Checking for update: SteamCMD"
fn_scriptlog "Failure! Checking for update: SteamCMD"
sleep 1
fn_printfail "Checking for update: SteamCMD: Not returning version info"
fn_scriptlog "Failure! Checking for update: SteamCMD: Not returning version info"
sleep 2
else
fn_printok "Checking for update: SteamCMD"
fn_scriptlog "Success! Checking for update: SteamCMD"
sleep 1
fi
if [ -z "${availablebuild}" ]; then
# Checks for server update from SteamDB.info if SteamCMD fails
echo ""
fn_printdots "Checking for update: SteamDB.info"
fn_scriptlog "Checking for update: SteamDB.info"
availablebuild=$(wget -qO- "http://steamdb.info/api/GetRawDepots/?appid=${appid}" | sed 's/\\n/\n/g' | grep -EA 1000 "^\s+\[branches\]" | grep -EA 5 "^\s+\[public\]" | grep -m 1 -EB 10 "^\s+\)$" | grep -E "^\s+\[buildid\]\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f4)
sleep 1
if [ -z "${availablebuild}" ]; then
fn_printfail "Checking for update: SteamDB.info"
fn_scriptlog "Failure! Checking for update: SteamDB.info"
sleep 1
fn_printfail "Checking for update: SteamDB.info: Not returning version info"
fn_scriptlog "Failure! Checking for update: SteamDB.info: Not returning version info"
sleep 2
else
fn_printok "Checking for update: SteamDB.info"
fn_scriptlog "Success! Checking for update: SteamDB.info"
sleep 1
fi
fi
if [ -z "${availablebuild}" ]; then
fn_logupdaterequest
fi
if [ "${currentbuild}" -ne "${availablebuild}" ]; then
echo -e "\n"
echo -e "Update available:"
sleep 1
echo -e " Current build: \e[0;31m${currentbuild}\e[0;39m"
echo -e " Available build: \e[0;32m${availablebuild}\e[0;39m"
echo -e ""
echo -e " https://steamdb.info/app/${appid}/"
sleep 1
echo ""
echo -en "Applying update.\r"
sleep 1
echo -en "Applying update..\r"
sleep 1
echo -en "Applying update...\r"
sleep 1
echo -en "\n"
fn_scriptlog "Update available"
fn_scriptlog "Current build: ${currentbuild}"
fn_scriptlog "Available build: ${availablebuild}"
fn_scriptlog "${currentbuild} > ${availablebuild}"
if [ ! -z "${norestart}" ]; then
fn_update_dl
else
fn_stop
fn_update_dl
fn_start
fi
else
echo -e "\n"
echo -e "No update available:"
echo -e " Current version: \e[0;32m${currentbuild}\e[0;39m"
echo -e " Available version: \e[0;32m${availablebuild}\e[0;39m"
echo -e " https://steamdb.info/app/${appid}/"
echo -e ""
fn_printoknl "No update available"
fn_scriptlog "Current build: ${currentbuild}"
fn_scriptlog "Available build: ${availablebuild}"
fi
}
fn_logupdaterequest(){
# Checks for server update requests from server logs.
echo ""
fn_printdots "Checking server logs for update requests"
sleep 1
fn_printok "Checking server logs for update requests"
fn_scriptlog "Checking server logs for update requests"
sleep 1
requestrestart=$(grep -sc "MasterRequestRestart" "${consolelog}")
if [ "${requestrestart}" -ge "1" ]; then
fn_printoknl "Server requesting update"
sleep 1
echo ""
echo -ne "Applying update.\r"
sleep 1
echo -ne "Applying update..\r"
sleep 1
echo -ne "Applying update...\r"
sleep 1
echo -ne "\n"
if [ ! -z "${norestart}" ]; then
fn_update_dl
else
fn_stop
fn_update_dl
fn_start
fi
else
fn_printok "No update request detected"
sleep 1
fi
echo ""
exit
}
fn_appmanifestinfo(){
appmanifestfile=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf")
appmanifestfilewc=$(find "${filesdir}" -type f -name "appmanifest_${appid}.acf"|wc -l)
}
fn_appmanifestcheck(){
fn_appmanifestinfo
# Multiple or no matching appmanifest files may sometimes be available.
# This is an error is corrected below if required.
if [ "${appmanifestfilewc}" -ge "2" ]; then
sleep 1
fn_printwarn "Multiple appmanifest_${appid}.acf files found"
fn_scriptlog "Warning! Multiple appmanifest_${appid}.acf files found"
sleep 2
fn_printdots "Removing x${appmanifestfilewc} appmanifest_${appid}.acf files"
sleep 1
for appfile in ${appmanifestfile}; do
rm "${appfile}"
done
appmanifestfilewc1="${appmanifestfilewc}"
fn_appmanifestinfo
if [ "${appmanifestfilewc}" -ge "2" ]; then
fn_printfail "Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
fn_scriptlog "Failure! Unable to remove x${appmanifestfilewc} appmanifest_${appid}.acf files"
sleep 1
echo ""
echo " Check user permissions"
for appfile in ${appmanifestfile}; do
echo " ${appfile}"
done
exit
else
sleep 1
fn_printok "Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
fn_scriptlog "Success! Removed x${appmanifestfilewc1} appmanifest_${appid}.acf files"
sleep 1
fn_printinfonl "Forcing update to correct issue"
fn_scriptlog "Forcing update to correct issue"
sleep 1
fn_update_dl
fn_update_check
fi
elif [ "${appmanifestfilewc}" -eq "0" ]; then
fn_printwarn "No appmanifest_${appid}.acf found"
fn_scriptlog "Warning! No appmanifest_${appid}.acf found"
sleep 2
fn_printinfonl "Forcing update to correct issue"
fn_scriptlog "Forcing update to correct issue"
sleep 1
fn_update_dl
fn_update_check
fi
}
fn_printdots "Checking for update"
fn_appmanifestcheck
fn_steamcmdcheck

21
functions/fn_update_dl

@ -0,0 +1,21 @@
#!/bin/bash
# LGSM fn_update_dl function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Runs a server update.
local modulename="Update"
fn_check_root
fn_check_systemdir
fn_details_config
fn_printdots "Updating ${servername}"
sleep 1
fn_check_steamcmd
fn_printoknl "Updating ${servername}"
fn_scriptlog "Updating ${servername}"
sleep 1
cd "${rootdir}"
cd "steamcmd"
./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" +quit|tee -a "${scriptlog}"

26
functions/fn_validate

@ -0,0 +1,26 @@
#!/bin/bash
# LGSM fn_validate function
# Author: Daniel Gibbs
# Website: http://danielgibbs.co.uk
# Version: 210115
# Description: Runs a server validation.
local modulename="Validate"
fn_check_root
fn_check_systemdir
fn_printwarn "Validating may overwrite some customised files."
sleep 1
echo -en "\n"
echo -en "https://developer.valvesoftware.com/wiki/SteamCMD#Validate"
sleep 5
echo -en "\n"
fn_printdots "Checking server files"
sleep 1
fn_printok "Checking server files"
fn_scriptlog "Checking server files"
sleep 1
cd "${rootdir}"
cd "steamcmd"
./steamcmd.sh +login "${steamuser}" "${steampass}" +force_install_dir "${filesdir}" +app_update "${appid}" validate +quit|tee -a "${scriptlog}"
fn_scriptlog "Checking complete"
Loading…
Cancel
Save