tfcserver 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # Team Fortress Classic
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. version="091215"
  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="dustbowl"
  17. maxplayers="16"
  18. port="27015"
  19. clientport="27005"
  20. ip="0.0.0.0"
  21. updateonstart="off"
  22. # https://developer.valvesoftware.com/wiki/Command_Line_Options#Command-line_parameters_2
  23. fn_parms(){
  24. parms="-game tfc -strictportbind _ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} -maxplayers ${maxplayers}"
  25. }
  26. #### Advanced Variables ####
  27. # Steam
  28. appid="90"
  29. appidmos="tfc"
  30. # Server Details
  31. servicename="tfc-server"
  32. gamename="Team Fortress Classic"
  33. engine="goldsource"
  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}/tfc"
  40. executabledir="${filesdir}"
  41. executable="./hlds_run"
  42. servercfg="${servicename}.cfg"
  43. servercfgdir="${systemdir}"
  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