csgoserver 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/bash
  2. # Counter Strike: Global Offensive
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. # Version: 090515
  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. updateonstart="no"
  34. # Optional: Workshop Parameters
  35. # https://developer.valvesoftware.com/wiki/CSGO_Workshop_For_Server_Operators
  36. # To get an authkey visit - http://steamcommunity.com/dev/apikey
  37. # authkey=""
  38. # ws_collection_id=""
  39. # ws_start_map=""
  40. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
  41. fn_parms(){
  42. 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}"
  43. }
  44. #### Advanced Variables ####
  45. # Steam
  46. appid="740"
  47. # Server Details
  48. servicename="csgo-server"
  49. gamename="Counter Strike: Global Offensive"
  50. engine="source"
  51. # Directories
  52. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
  53. selfname="$(basename $0)"
  54. lockselfname=".${servicename}.lock"
  55. filesdir="${rootdir}/serverfiles"
  56. systemdir="${filesdir}/csgo"
  57. executabledir="${filesdir}"
  58. executable="./srcds_run"
  59. servercfgdir="${systemdir}/cfg"
  60. servercfg="${servicename}.cfg"
  61. servercfgfullpath="${servercfgdir}/${servercfg}"
  62. defaultcfg="${servercfgdir}/server.cfg"
  63. backupdir="${rootdir}/backups"
  64. # Logging
  65. logdays="7"
  66. gamelogdir="${systemdir}/logs"
  67. scriptlogdir="${rootdir}/log/script"
  68. consolelogdir="${rootdir}/log/console"
  69. scriptlog="${scriptlogdir}/${servicename}-script.log"
  70. consolelog="${consolelogdir}/${servicename}-console.log"
  71. emaillog="${scriptlogdir}/${servicename}-email.log"
  72. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  73. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  74. ##### Script #####
  75. # Do not edit
  76. fn_runfunction(){
  77. # Functions are downloaded and run with this function
  78. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  79. cd "${rootdir}"
  80. if [ ! -d "functions" ]; then
  81. mkdir functions
  82. fi
  83. cd functions
  84. echo -e "loading ${functionfile}...\c"
  85. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  86. chmod +x "${functionfile}"
  87. cd "${rootdir}"
  88. sleep 1
  89. fi
  90. source "${rootdir}/functions/${functionfile}"
  91. }
  92. fn_functions(){
  93. # Functions are defined in fn_functions.
  94. functionfile="${FUNCNAME}"
  95. fn_runfunction
  96. }
  97. fn_functions
  98. getopt=$1
  99. fn_getopt