hldmsserver 2.4 KB

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