Advertisement
Guest User

CSGO

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