l4dserver 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # Left 4 Dead
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Contributor: Summit Singh Thakur
  6. # Website: http://gameservermanagers.com
  7. version="291015"
  8. #### Variables ####
  9. # Notification Email
  10. # (on|off)
  11. emailnotification="off"
  12. email="email@example.com"
  13. # Steam login
  14. steamuser="anonymous"
  15. steampass=""
  16. # Start Variables
  17. defaultmap="l4d_hospital01_apartment"
  18. maxplayers="8"
  19. port="27015"
  20. clientport="27005"
  21. ip="0.0.0.0"
  22. updateonstart="off"
  23. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Source_Dedicated_Server
  24. fn_parms(){
  25. parms="-game left4dead -strictportbind -ip ${ip} -port ${port} +clientport ${clientport} -tickrate ${tickrate} +map ${defaultmap} -maxplayers ${maxplayers}"
  26. }
  27. #### Advanced Variables ####
  28. # Steam
  29. appid="222840"
  30. # Server Details
  31. servicename="l4d-server"
  32. gamename="Left 4 Dead"
  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}/left4dead"
  40. executabledir="${filesdir}"
  41. executable="./srcds_run"
  42. servercfg="${servicename}.cfg"
  43. servercfgdir="${systemdir}/cfg"
  44. servercfgfullpath="${servercfgdir}/${servercfg}"
  45. servercfgdefault="${servercfgdir}/lgsm-default.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. fi
  72. source "${rootdir}/functions/${functionfile}"
  73. }
  74. fn_functions(){
  75. # Functions are defined in fn_functions.
  76. functionfile="${FUNCNAME}"
  77. fn_runfunction
  78. }
  79. fn_functions
  80. getopt=$1
  81. fn_getopt