SHARE
TWEET

Untitled

a guest May 30th, 2017 510 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # Project: Game Server Managers - LinuxGSM
  3. # Author: Daniel Gibbs
  4. # License: MIT License, Copyright (c) 2017 Daniel Gibbs
  5. # Purpose: Blade Symphony | Server Management Script
  6. # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
  7. # Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
  8. # Website: https://gameservermanagers.com
  9.  
  10. # Debugging
  11. if [ -f ".dev-debug" ]; then
  12.     exec 5>dev-debug.log
  13.     BASH_XTRACEFD="5"
  14.     set -x
  15. fi
  16.  
  17. version="170501"
  18.  
  19. ##########################
  20. ######## Settings ########
  21. ##########################
  22.  
  23. #### Server Settings ####
  24.  
  25. ## SteamCMD Login | https://github.com/GameServerManagers/LinuxGSM/wiki/SteamCMD#steamcmd-login
  26. steamuser=""
  27. steampass=''
  28.  
  29. ## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
  30. defaultmap="duel_winter"
  31. maxplayers="16"
  32. port="27015"
  33. sourcetvport="27020"
  34. clientport="27005"
  35. ip="0.0.0.0"
  36. tickrate="60"
  37.  
  38. ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
  39. fn_parms(){
  40. parms="-autoupdate -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} -tickrate ${tickrate}"
  41. }
  42.  
  43. #### LinuxGSM Settings ####
  44.  
  45. ## Notification Alerts
  46. # (on|off)
  47. # Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
  48. emailalert="off"
  49. email="email@example.com"
  50. emailfrom=""
  51.  
  52. # Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
  53. pushbulletalert="off"
  54. pushbullettoken="accesstoken"
  55. channeltag=""
  56.  
  57. ## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
  58. updateonstart="off"
  59.  
  60. ## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
  61. maxbackups="4"
  62. maxbackupdays="30"
  63. stoponbackup="on"
  64.  
  65. ## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
  66. consolelogging="on"
  67. logdays="7"
  68.  
  69. #### LinuxGSM Advanced Settings ####
  70.  
  71. ## SteamCMD Settings
  72. # Server appid
  73. appid="228780"
  74. # Steam App Branch Select
  75. # Allows to opt into the various Steam app branches. Default branch is "".
  76. # Example: "-beta latest_experimental"
  77. branch=""
  78.  
  79. ## Github Branch Select
  80. # Allows for the use of different function files
  81. # from a different repo and/or branch.
  82. githubuser="GameServerManagers"
  83. githubrepo="LinuxGSM"
  84. githubbranch="master"
  85.  
  86. ## LinuxGSM Server Details
  87. # Do not edit
  88. gamename="Blade Symphony"
  89. engine="source"
  90.  
  91. ## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
  92. servicename="bs-server"
  93.  
  94. #### Directories ####
  95. # Edit with care
  96.  
  97. ## Work Directories
  98. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  99. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  100. lockselfname=".${servicename}.lock"
  101. lgsmdir="${rootdir}/lgsm"
  102. functionsdir="${lgsmdir}/functions"
  103. libdir="${lgsmdir}/lib"
  104. tmpdir="${lgsmdir}/tmp"
  105. filesdir="${rootdir}/serverfiles"
  106.  
  107. ## Server Specific Directories
  108. systemdir="${filesdir}/berimbau"
  109. executabledir="${filesdir}"
  110. executable="./srcds_run.sh"
  111. servercfg="${servicename}.cfg"
  112. servercfgdefault="server.cfg"
  113. servercfgdir="${systemdir}/cfg"
  114. servercfgfullpath="${servercfgdir}/${servercfg}"
  115.  
  116. ## Backup Directory
  117. backupdir="${rootdir}/backups"
  118.  
  119. ## Logging Directories
  120. gamelogdir="${systemdir}/logs"
  121. scriptlogdir="${rootdir}/log/script"
  122. consolelogdir="${rootdir}/log/console"
  123. scriptlog="${scriptlogdir}/${servicename}-script.log"
  124. consolelog="${consolelogdir}/${servicename}-console.log"
  125. emaillog="${scriptlogdir}/${servicename}-email.log"
  126.  
  127. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
  128. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
  129.  
  130. ########################
  131. ######## Script ########
  132. ###### Do not edit #####
  133. ########################
  134.  
  135. # Fetches core_dl for file downloads
  136. fn_fetch_core_dl(){
  137. github_file_url_dir="lgsm/functions"
  138. github_file_url_name="${functionfile}"
  139. filedir="${functionsdir}"
  140. filename="${github_file_url_name}"
  141. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  142. # If the file is missing, then download
  143. if [ ! -f "${filedir}/${filename}" ]; then
  144.     if [ ! -d "${filedir}" ]; then
  145.         mkdir -p "${filedir}"
  146.     fi
  147.     echo -e "    fetching ${filename}...\c"
  148.     # Check curl exists and use available path
  149.     curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  150.     for curlcmd in ${curlpaths}
  151.     do
  152.         if [ -x "${curlcmd}" ]; then
  153.             break
  154.         fi
  155.     done
  156.     # If curl exists download file
  157.     if [ "$(basename ${curlcmd})" == "curl" ]; then
  158.         curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  159.         if [ $? -ne 0 ]; then
  160.             echo -e "\e[0;31mFAIL\e[0m\n"
  161.             echo "${curlfetch}"
  162.             echo -e "${githuburl}\n"
  163.             exit 1
  164.         else
  165.             echo -e "\e[0;32mOK\e[0m"
  166.         fi
  167.     else
  168.         echo -e "\e[0;31mFAIL\e[0m\n"
  169.         echo "Curl is not installed!"
  170.         echo -e ""
  171.         exit 1
  172.     fi
  173.     chmod +x "${filedir}/${filename}"
  174. fi
  175. source "${filedir}/${filename}"
  176. }
  177.  
  178. core_dl.sh(){
  179. # Functions are defined in core_functions.sh.
  180. functionfile="${FUNCNAME}"
  181. fn_fetch_core_dl
  182. }
  183.  
  184. core_functions.sh(){
  185. # Functions are defined in core_functions.sh.
  186. functionfile="${FUNCNAME}"
  187. fn_fetch_core_dl
  188. }
  189.  
  190. # Prevent from running this script as root.
  191. if [ "$(whoami)" = "root" ]; then
  192.     if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then
  193.         echo "[ FAIL ] Do NOT run this script as root!"
  194.         exit 1
  195.     else
  196.         core_functions.sh
  197.         check_root.sh
  198.     fi
  199. fi
  200.  
  201. core_dl.sh
  202. core_functions.sh
  203. getopt=$1
  204. core_getopt.sh
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top