ss3sserver 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #!/bin/bash
  2. # Serious Sam 3: BFE
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://danielgibbs.co.uk
  6. # Version: 010115
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Steam login
  13. steamuser="username"
  14. steampass="password"
  15. # Start Variables
  16. ip="0.0.0.0"
  17. # https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/SeriousSam3BFE/help/DedicatedServer_Readme.txt
  18. fn_parms(){
  19. parms="+ip ${ip} +logfile ${gamelog} +exec ${servercfgfullpath}"
  20. }
  21. #### Advanced Variables ####
  22. # Steam
  23. appid="41080"
  24. # Server Details
  25. servicename="ss3-server"
  26. gamename="Serious Sam 3: BFE"
  27. engine="seriousengine35"
  28. # Directories
  29. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  30. selfname="$0"
  31. lockselfname=$(echo ".${servicename}.lock")
  32. filesdir="${rootdir}/serverfiles"
  33. systemdir="${filesdir}/Bin"
  34. executabledir="${systemdir}"
  35. executable="./runSam3_DedicatedServer.sh"
  36. servercfgdir="${filesdir}/Content/SeriousSam3/Config"
  37. servercfg="${servicename}.ini"
  38. servercfgfullpath="${servercfgdir}/${servercfg}"
  39. backupdir="backups"
  40. # Logging
  41. logdays="7"
  42. gamelogdir="${rootdir}/log/server"
  43. scriptlogdir="${rootdir}/log/script"
  44. consolelogdir="${rootdir}/log/console"
  45. gamelog="${gamelogdir}/${servicename}-game.log"
  46. scriptlog="${scriptlogdir}/${servicename}-script.log"
  47. consolelog="${consolelogdir}/${servicename}-console.log"
  48. emaillog="${scriptlogdir}/${servicename}-email.log"
  49. gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%d-%m-%Y-%H-%M-%S').log"
  50. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  51. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  52. ##### Script #####
  53. # Do not edit
  54. fn_install(){
  55. fn_rootcheck
  56. fn_header
  57. if [ -z "${autoinstall}" ]; then
  58. fn_serverdirectory
  59. fn_header
  60. fi
  61. fn_steamdl
  62. fn_steaminstall
  63. fn_steamfix
  64. fn_glibcfix
  65. fn_loginstall
  66. fn_serverconfig
  67. fn_header
  68. fn_details
  69. fn_installcomplete
  70. }
  71. fn_functions(){
  72. # Functions are defines in fn_functions.
  73. functionfile="${FUNCNAME}"
  74. fn_runfunction
  75. }
  76. fn_runfunction(){
  77. # Functions are downloaded and run with this function
  78. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  79. cd "${rootdir}"
  80. if [ ! -d "functions" ]; then
  81. mkdir functions
  82. fi
  83. cd functions
  84. echo -e "loading ${functionfile}...\c"
  85. wget -N --no-check-certificate /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgameservers/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  86. chmod +x "${functionfile}"
  87. cd "${rootdir}"
  88. sleep 1
  89. fi
  90. source "${rootdir}/functions/${functionfile}"
  91. }
  92. fn_functions
  93. case "$1" in
  94. start)
  95. fn_startserver;;
  96. stop)
  97. fn_stopserver;;
  98. restart)
  99. fn_restartserver;;
  100. update)
  101. norestart=1;
  102. fn_versioncheck;;
  103. update-restart)
  104. fn_versioncheck;;
  105. validate)
  106. fn_validateserver;;
  107. validate-restart)
  108. fn_stopserver
  109. fn_validateserver
  110. fn_startserver;;
  111. monitor)
  112. fn_monitorserver;;
  113. email-test)
  114. fn_emailtest;;
  115. details)
  116. fn_details;;
  117. backup)
  118. fn_backupserver;;
  119. console)
  120. fn_console;;
  121. debug)
  122. fn_debugserver;;
  123. install)
  124. fn_install;;
  125. auto-install)
  126. fn_autoinstall;;
  127. *)
  128. echo "Usage: $0 {start|stop|restart|update|update-restart|validate|validate-restart|monitor|email-test|details|backup|console|debug|install|auto-install}"
  129. exit 1;;
  130. esac
  131. exit