Guest User

CSGO

a guest
May 2nd, 2016
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.12 KB | None | 0 0
  1. #!/bin/bash
  2. # Counter Strike: Global Offensive
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. if [ -f ".dev-debug" ]; then
  7. exec 5>dev-debug.log
  8. BASH_XTRACEFD="5"
  9. set -x
  10. fi
  11.  
  12. version="271215"
  13.  
  14. #### Variables ####
  15.  
  16. # Notification Email
  17. # (on|off)
  18. emailnotification="off"
  19.  
  20. # Steam login
  21. steamuser="anonymous"
  22. steampass=""
  23.  
  24. # Start Variables
  25. # https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Dedicated_Servers#Starting_the_Server
  26. # [Game Modes] gametype gamemode
  27. # Arms Race 1 0
  28. # Classic Casual 0 0
  29. # Classic Competitive 0 1
  30. # Demolition 1 1
  31. # Deathmatch 1 2
  32. gamemode="0"
  33. gametype="0"
  34. defaultmap="de_dust2"
  35. mapgroup="random_classic"
  36. maxplayers="16"
  37. tickrate="64"
  38. port="27015"
  39. sourcetvport="27020"
  40. clientport="27005"
  41. ip="0.0.0.0"
  42. updateonstart="off"
  43.  
  44. # Required: Game Server Login Token
  45. # GSLT is required for running a public server.
  46. # More info: http://gameservermanagers.com/gslt
  47. gslt="ProjectGaming"
  48.  
  49. # Optional: Workshop Parameters
  50. # https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
  51. # To get an authkey visit - http://steamcommunity.com/dev/apikey
  52. # authkey=""
  53. # ws_collection_id=""
  54. # ws_start_map=""
  55.  
  56. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
  57. fn_parms(){
  58. parms="-game csgo -usercon -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} -tickrate ${tickrate}$
  59. clientport="27005"
  60. ip="0.0.0.0"
  61. updateonstart="off"
  62.  
  63. # Required: Game Server Login Token
  64. # GSLT is required for running a public server.
  65. # More info: http://gameservermanagers.com/gslt
  66. gslt="ProjectGaming"
  67.  
  68. # Optional: Workshop Parameters
  69. # https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
  70. # To get an authkey visit - http://steamcommunity.com/dev/apikey
  71. # authkey=""
  72. # ws_collection_id=""
  73. # ws_start_map=""
  74.  
  75. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
  76. fn_parms(){
  77. parms="-game csgo -usercon -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} +sv_setsteamaccount ${gslt} -tickrate ${tickrate}$
  78. }
  79.  
  80. #### Advanced Variables ####
  81.  
  82. # Github Branch Select
  83. # Allows for the use of different function files
  84. # from a different repo and/or branch.
  85. githubuser="dgibbs64"
  86. githubrepo="linuxgsm"
  87. githubbranch="master"
  88.  
  89. # Steam
  90. appid="740"
  91.  
  92. # Server Details
  93. servicename="csgo-server"
  94. gamename="Counter Strike: Global Offensive"
  95. engine="source"
  96.  
  97. # Directories
  98. #### Advanced Variables ####
  99.  
  100. # Github Branch Select
  101. # Allows for the use of different function files
  102. # from a different repo and/or branch.
  103. githubuser="dgibbs64"
  104. githubrepo="linuxgsm"
  105. githubbranch="master"
  106.  
  107. # Steam
  108. appid="740"
  109.  
  110. # Server Details
  111. servicename="csgo-server"
  112. gamename="Counter Strike: Global Offensive"
  113. engine="source"
  114.  
  115. # Directories
  116. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  117. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  118. lockselfname=".${servicename}.lock"
  119. filesdir="${rootdir}/serverfiles"
  120. systemdir="${filesdir}/csgo"
  121. executabledir="${filesdir}"
  122. executable="./srcds_run"
  123. servercfg="${servicename}.cfg"
  124. servercfgdir="${systemdir}/cfg"
  125. servercfgfullpath="${servercfgdir}/${servercfg}"
  126. servercfgdefault="${servercfgdir}/lgsm-default.cfg"
  127. backupdir="${rootdir}/backups"
  128.  
  129. # Logging
  130. logdays="7"
  131. gamelogdir="${systemdir}/logs"
  132. scriptlogdir="${rootdir}/log/script"
  133. consolelogdir="${rootdir}/log/console"
  134.  
  135. scriptlog="${scriptlogdir}/${servicename}-script.log"
  136. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  137. lockselfname=".${servicename}.lock"
  138. filesdir="${rootdir}/serverfiles"
  139. systemdir="${filesdir}/csgo"
  140. executabledir="${filesdir}"
  141. executable="./srcds_run"
  142. servercfg="${servicename}.cfg"
  143. servercfgdir="${systemdir}/cfg"
  144. servercfgfullpath="${servercfgdir}/${servercfg}"
  145. servercfgdefault="${servercfgdir}/lgsm-default.cfg"
  146. backupdir="${rootdir}/backups"
  147.  
  148. # Logging
  149. logdays="7"
  150. gamelogdir="${systemdir}/logs"
  151. scriptlogdir="${rootdir}/log/script"
  152. consolelogdir="${rootdir}/log/console"
  153.  
  154. scriptlog="${scriptlogdir}/${servicename}-script.log"
  155. consolelog="${consolelogdir}/${servicename}-console.log"
  156. emaillog="${scriptlogdir}/${servicename}-email.log"
  157.  
  158. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  159. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  160.  
  161. ##### Script #####
  162. # Do not edit
  163.  
  164. fn_getgithubfile(){
  165. filename=$1
  166. exec=$2
  167. fileurl=${3:-$filename}
  168. filepath="${rootdir}/${filename}"
  169. filedir=$(dirname "${filepath}")
  170. # If the function file is missing, then download
  171. if [ ! -f "${filepath}" ]; then
  172. if [ ! -d "${filedir}" ]; then
  173. mkdir "${filedir}"
  174. fi
  175. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  176. echo -e " fetching ${filename}...\c"
  177. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  178. :
  179. else
  180. echo -e "\e[0;31mFAIL\e[0m\n"
  181. echo "Curl is not installed!"
  182. echo -e ""
  183. exit
  184. fi
  185. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  186. if [ $? -ne 0 ]; then
  187. echo -e "\e[0;31mFAIL\e[0m\n"
  188. echo "${curl}"
  189. echo -e "${githuburl}\n"
  190. exit
  191. else
  192. echo -e "\e[0;32mOK\e[0m"
  193. fi
  194. if [ "${exec}" ]; then
  195. chmod +x "${filepath}"
  196. fi
  197. fi
  198. if [ "${exec}" ]; then
  199. source "${filepath}"
  200. fi
  201. }
  202.  
  203. fn_runfunction(){
  204. fn_getgithubfile "functions/${functionfile}" 1
  205. }
  206.  
  207. core_functions.sh(){
  208. # Functions are defined in core_functions.sh.
  209. functionfile="${FUNCNAME}"
  210. fn_runfunction
  211. }
  212.  
  213. core_functions.sh
  214. getopt=$1
  215. core_getopt.sh
Advertisement
Add Comment
Please, Sign In to add comment