csgoserver 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/bash
  2. # Counter Strike: Global Offensive
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://danielgibbs.co.uk
  6. # Version: 210115
  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. # https://developer.valvesoftware.com/wiki/Counter-Strike:_Global_Offensive_Dedicated_Servers#Starting_the_Server
  17. # [Game Modes] gametype gamemode
  18. # Arms Race 1 0
  19. # Classic Casual 0 0
  20. # Classic Competitive 0 1
  21. # Demolition 1 1
  22. # Deathmatch 1 2
  23. gamemode="0"
  24. gametype="0"
  25. defaultmap="de_dust2"
  26. mapgroup="random_classic"
  27. maxplayers="16"
  28. tickrate="64"
  29. port="27015"
  30. sourcetvport="27020"
  31. clientport="27005"
  32. ip="0.0.0.0"
  33. # Optional: Workshop Parameters
  34. # https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
  35. # To get an authkey visit - http://steamcommunity.com/dev/apikey
  36. # authkey=""
  37. # ws_collection_id=""
  38. # ws_start_map=""
  39. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
  40. fn_parms(){
  41. parms="-game csgo -usercon -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +tv_port ${sourcetvport} -tickrate ${tickrate} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers_override ${maxplayers} +mapgroup ${mapgroup} +game_mode ${gamemode} +game_type ${gametype} +host_workshop_collection ${ws_collection_id} +workshop_start_map ${ws_start_map} -authkey ${authkey}"
  42. }
  43. #### Advanced Variables ####
  44. # Steam
  45. appid="740"
  46. # Server Details
  47. servicename="csgo-server"
  48. gamename="Counter Strike: Global Offensive"
  49. engine="source"
  50. # Directories
  51. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
  52. selfname="$(basename $0)"
  53. lockselfname=".${servicename}.lock"
  54. filesdir="${rootdir}/serverfiles"
  55. systemdir="${filesdir}/csgo"
  56. executabledir="${filesdir}"
  57. executable="./srcds_run"
  58. servercfgdir="${systemdir}/cfg"
  59. servercfg="${servicename}.cfg"
  60. servercfgfullpath="${servercfgdir}/${servercfg}"
  61. defaultcfg="${servercfgdir}/server.cfg"
  62. backupdir="${rootdir}/backups"
  63. # Logging
  64. logdays="7"
  65. gamelogdir="${systemdir}/logs"
  66. scriptlogdir="${rootdir}/log/script"
  67. consolelogdir="${rootdir}/log/console"
  68. scriptlog="${scriptlogdir}/${servicename}-script.log"
  69. consolelog="${consolelogdir}/${servicename}-console.log"
  70. emaillog="${scriptlogdir}/${servicename}-email.log"
  71. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  72. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  73. ##### Script #####
  74. # Do not edit
  75. fn_runfunction(){
  76. # Functions are downloaded and run with this function
  77. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  78. cd "${rootdir}"
  79. if [ ! -d "functions" ]; then
  80. mkdir functions
  81. fi
  82. cd functions
  83. echo -e "loading ${functionfile}...\c"
  84. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  85. chmod +x "${functionfile}"
  86. cd "${rootdir}"
  87. sleep 1
  88. fi
  89. source "${rootdir}/functions/${functionfile}"
  90. }
  91. fn_functions(){
  92. # Functions are defined in fn_functions.
  93. functionfile="${FUNCNAME}"
  94. fn_runfunction
  95. }
  96. fn_functions
  97. getopt=$1
  98. fn_getopt