jc2server 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. # Just Cause 2
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. version="150715"
  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. updateonstart="off"
  17. fn_parms(){
  18. parms=""
  19. }
  20. #### Advanced Variables ####
  21. # Steam
  22. appid="261140"
  23. # Server Details
  24. servicename="jc2-server"
  25. gamename="Just Cause 2"
  26. engine="avalanche"
  27. # Directories
  28. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  29. selfname="$(basename $0)"
  30. lockselfname=".${servicename}.lock"
  31. filesdir="${rootdir}/serverfiles"
  32. systemdir="${filesdir}"
  33. executabledir="${filesdir}"
  34. executable="./Jcmp-Server"
  35. servercfg="config.lua"
  36. servercfgdir="${filesdir}"
  37. servercfgfullpath="${servercfgdir}/${servercfg}"
  38. servercfgdefault="${servercfgdir}/default_config.lua"
  39. backupdir="${rootdir}/backups"
  40. # Logging
  41. logdays="7"
  42. #gamelogdir="" # No server logs available
  43. scriptlogdir="${rootdir}/log/script"
  44. consolelogdir="${rootdir}/log/console"
  45. scriptlog="${scriptlogdir}/${servicename}-script.log"
  46. consolelog="${consolelogdir}/${servicename}-console.log"
  47. emaillog="${scriptlogdir}/${servicename}-email.log"
  48. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  49. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  50. ##### Script #####
  51. # Do not edit
  52. fn_runfunction(){
  53. # Functions are downloaded and run with this function
  54. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  55. cd "${rootdir}"
  56. if [ ! -d "functions" ]; then
  57. mkdir functions
  58. fi
  59. cd functions
  60. echo -e " loading ${functionfile}...\c"
  61. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  62. chmod +x "${functionfile}"
  63. cd "${rootdir}"
  64. fi
  65. source "${rootdir}/functions/${functionfile}"
  66. }
  67. fn_functions(){
  68. # Functions are defined in fn_functions.
  69. functionfile="${FUNCNAME}"
  70. fn_runfunction
  71. }
  72. fn_functions
  73. getopt=$1
  74. fn_getopt