4
0

arma3server 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. #!/bin/bash
  2. # ARMA 3
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Contributor: Scarsz
  6. # Website: http://gameservermanagers.com
  7. version="121215"
  8. #### Variables ####
  9. # Notification Email
  10. # (on|off)
  11. emailnotification="off"
  12. email="email@example.com"
  13. # Steam login
  14. steamuser="username"
  15. steampass="password"
  16. # Start Variables
  17. ip="0.0.0.0"
  18. updateonstart="off"
  19. fn_parms(){
  20. parms="-netlog -ip=${ip} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=${mods}"
  21. }
  22. # ARMA 3 Modules
  23. # add mods with relative paths:
  24. # mods/\@CBA_A3\;
  25. # or several mods as:
  26. # mods/\@CBA_A3\;mods/\@task_force_radio
  27. # and chmod modules directories to 775
  28. mods=""
  29. #### Advanced Variables ####
  30. # Github Branch Select
  31. # Allows for the use of different function files
  32. # from a different repo and/or branch.
  33. githubuser="dgibbs64"
  34. githubrepo="linuxgsm"
  35. githubbranch="master"
  36. # Steam
  37. # Stable
  38. appid="233780"
  39. # Development
  40. # appid="233780 -beta development"
  41. # Server Details
  42. servicename="arma3-server"
  43. gamename="ARMA 3"
  44. engine="realvirtuality"
  45. # Directories
  46. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  47. selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
  48. lockselfname=".${servicename}.lock"
  49. filesdir="${rootdir}/serverfiles"
  50. systemdir="${filesdir}"
  51. executabledir="${filesdir}"
  52. executable="./arma3server"
  53. servercfg="${servicename}.server.cfg"
  54. networkcfg="${servicename}.network.cfg"
  55. servercfgdir="${systemdir}/cfg"
  56. servercfgfullpath="${servercfgdir}/${servercfg}"
  57. networkcfgfullpath="${servercfgdir}/${networkcfg}"
  58. servercfgdefault="${servercfgdir}/lgsm-default.server.cfg"
  59. networkcfgdefault="${servercfgdir}/lgsm-default.network.cfg"
  60. backupdir="${rootdir}/backups"
  61. # Logging
  62. logdays="7"
  63. #gamelogdir="" # No server logs available
  64. scriptlogdir="${rootdir}/log/script"
  65. consolelogdir="${rootdir}/log/console"
  66. scriptlog="${scriptlogdir}/${servicename}-script.log"
  67. consolelog="${consolelogdir}/${servicename}-console.log"
  68. emaillog="${scriptlogdir}/${servicename}-email.log"
  69. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  70. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  71. ##### Script #####
  72. # Do not edit
  73. fn_getgithubfile(){
  74. filename=$1
  75. exec=$2
  76. fileurl=${3:-$filename}
  77. filepath="${rootdir}/${filename}"
  78. filedir=$(dirname "${filepath}")
  79. # If the function file is missing, then download
  80. if [ ! -f "${filepath}" ]; then
  81. if [ ! -d "${filedir}" ]; then
  82. mkdir "${filedir}"
  83. fi
  84. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  85. echo -e " fetching ${filename}...\c"
  86. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  87. :
  88. else
  89. echo -e "\e[0;31mFAIL\e[0m\n"
  90. echo "Curl is not installed!"
  91. echo -e ""
  92. exit
  93. fi
  94. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  95. if [ $? -ne 0 ]; then
  96. echo -e "\e[0;31mFAIL\e[0m\n"
  97. echo " ${curl}"|grep "curl:"
  98. echo -e "${githuburl}\n"
  99. exit
  100. else
  101. echo -e "\e[0;32mOK\e[0m"
  102. fi
  103. if [ "${exec}" ]; then
  104. chmod +x "${filepath}"
  105. fi
  106. fi
  107. if [ "${exec}" ]; then
  108. source "${filepath}"
  109. fi
  110. }
  111. fn_runfunction(){
  112. fn_getgithubfile "functions/${functionfile}" 1
  113. }
  114. fn_functions(){
  115. # Functions are defined in fn_functions.
  116. functionfile="${FUNCNAME}"
  117. fn_runfunction
  118. }
  119. fn_functions
  120. getopt=$1
  121. fn_getopt