ss3sserver 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/bin/bash
  2. # Serious Sam 3: BFE
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. version="121215"
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Steam login
  13. steamuser="anonymous"
  14. steampass=""
  15. # Start Variables
  16. ip="0.0.0.0"
  17. updateonstart="off"
  18. # https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/SeriousSam3BFE/help/DedicatedServer_Readme.txt
  19. fn_parms(){
  20. parms="+ip ${ip} +logfile ${gamelog} +exec ${servercfgfullpath}"
  21. }
  22. #### Advanced Variables ####
  23. # Github Branch Select
  24. # Allows for the use of different function files
  25. # from a different repo and/or branch.
  26. githubuser="dgibbs64"
  27. githubrepo="linuxgsm"
  28. githubbranch="master"
  29. # Steam
  30. appid="41080"
  31. # Server Details
  32. servicename="ss3-server"
  33. gamename="Serious Sam 3: BFE"
  34. engine="seriousengine35"
  35. # Directories
  36. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  37. selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
  38. lockselfname=".${servicename}.lock"
  39. filesdir="${rootdir}/serverfiles"
  40. systemdir="${filesdir}/Bin"
  41. executable="./runSam3_DedicatedServer.sh"
  42. executabledir="${systemdir}"
  43. servercfg="${servicename}.ini"
  44. servercfgdir="${filesdir}/Content/SeriousSam3/Config"
  45. servercfgfullpath="${servercfgdir}/${servercfg}"
  46. servercfgdefault="${servercfgdir}/lgsm-default.ini"
  47. backupdir="${rootdir}/backups"
  48. # Logging
  49. logdays="7"
  50. gamelogdir="${rootdir}/log/server"
  51. scriptlogdir="${rootdir}/log/script"
  52. consolelogdir="${rootdir}/log/console"
  53. gamelog="${gamelogdir}/${servicename}-game.log"
  54. scriptlog="${scriptlogdir}/${servicename}-script.log"
  55. consolelog="${consolelogdir}/${servicename}-console.log"
  56. emaillog="${scriptlogdir}/${servicename}-email.log"
  57. gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').log"
  58. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  59. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  60. ##### Script #####
  61. # Do not edit
  62. fn_getgithubfile(){
  63. filename=$1
  64. exec=$2
  65. fileurl=${3:-$filename}
  66. filepath="${rootdir}/${filename}"
  67. filedir=$(dirname "${filepath}")
  68. # If the function file is missing, then download
  69. if [ ! -f "${filepath}" ]; then
  70. if [ ! -d "${filedir}" ]; then
  71. mkdir "${filedir}"
  72. fi
  73. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  74. echo -e " fetching ${filename}...\c"
  75. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  76. :
  77. else
  78. echo -e "\e[0;31mFAIL\e[0m\n"
  79. echo "Curl is not installed!"
  80. echo -e ""
  81. exit
  82. fi
  83. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  84. if [ $? -ne 0 ]; then
  85. echo -e "\e[0;31mFAIL\e[0m\n"
  86. echo " ${curl}"|grep "curl:"
  87. echo -e "${githuburl}\n"
  88. exit
  89. else
  90. echo -e "\e[0;32mOK\e[0m"
  91. fi
  92. if [ "${exec}" ]; then
  93. chmod +x "${filepath}"
  94. fi
  95. fi
  96. if [ "${exec}" ]; then
  97. source "${filepath}"
  98. fi
  99. }
  100. fn_runfunction(){
  101. fn_getgithubfile "functions/${functionfile}" 1
  102. }
  103. fn_functions(){
  104. # Functions are defined in fn_functions.
  105. functionfile="${FUNCNAME}"
  106. fn_runfunction
  107. }
  108. fn_functions
  109. getopt=$1
  110. fn_getopt