jc2server 2.1 KB

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