csczserver 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #!/bin/bash
  2. # Counter Strike: Condition Zero
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. # Version: 030515
  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. defaultmap="de_dust2"
  17. maxplayers="16"
  18. port="27015"
  19. clientport="27005"
  20. ip="0.0.0.0"
  21. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
  22. fn_parms(){
  23. parms="-game czero -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
  24. }
  25. #### Advanced Variables ####
  26. # Steam
  27. appid="90 +app_set_config 90 mod czero"
  28. # Server Details
  29. servicename="cscz-server"
  30. gamename="Counter Strike: Condition Zero"
  31. engine="goldsource"
  32. # Directories
  33. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )"
  34. selfname="$0"
  35. lockselfname=$(echo ".${servicename}.lock")
  36. filesdir="${rootdir}/serverfiles"
  37. systemdir="${filesdir}/czero"
  38. executabledir="${filesdir}"
  39. executable="./hlds_run"
  40. servercfgdir="${systemdir}"
  41. servercfg="${servicename}.cfg"
  42. servercfgfullpath="${servercfgdir}/${servercfg}"
  43. defaultcfg="${servercfgdir}/server.cfg"
  44. backupdir="${rootdir}/backups"
  45. # Logging
  46. logdays="7"
  47. gamelogdir="${systemdir}/logs"
  48. scriptlogdir="${rootdir}/log/script"
  49. consolelogdir="${rootdir}/log/console"
  50. scriptlog="${scriptlogdir}/${servicename}-script.log"
  51. consolelog="${consolelogdir}/${servicename}-console.log"
  52. emaillog="${scriptlogdir}/${servicename}-email.log"
  53. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  54. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  55. ##### Script #####
  56. # Do not edit
  57. fn_runfunction(){
  58. # Functions are downloaded and run with this function
  59. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  60. cd "${rootdir}"
  61. if [ ! -d "functions" ]; then
  62. mkdir functions
  63. fi
  64. cd functions
  65. echo -e "loading ${functionfile}...\c"
  66. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  67. chmod +x "${functionfile}"
  68. cd "${rootdir}"
  69. sleep 1
  70. fi
  71. source "${rootdir}/functions/${functionfile}"
  72. }
  73. fn_functions(){
  74. # Functions are defined in fn_functions.
  75. functionfile="${FUNCNAME}"
  76. fn_runfunction
  77. }
  78. fn_functions
  79. getopt=$1
  80. fn_getopt