dodsserver 2.4 KB

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