Advertisement
Guest User

Untitled

a guest
Jan 8th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. #!/bin/bash
  2. # ARMA 3
  3. # Server Management Script
  4.  
  5. if [ -f ".dev-debug" ]; then
  6. exec 5>dev-debug.log
  7. BASH_XTRACEFD="5"
  8. set -x
  9. fi
  10.  
  11. version="210516"
  12.  
  13. #### Variables ####
  14.  
  15. # Notification Alerts
  16. # (on|off)
  17.  
  18. # Email
  19. emailalert="off"
  20. email="email@example.com"
  21.  
  22. # Pushbullet
  23. # https://www.pushbullet.com/#settings
  24. pushbulletalert="off"
  25. pushbullettoken="accesstoken"
  26.  
  27. # Steam login
  28. steamuser="dnr_clan"
  29. steampass="Master.asyxcd123"
  30.  
  31. # Start Variables
  32. ip="0.0.0.0"
  33. port="2322"
  34. updateonstart="off"
  35.  
  36. fn_parms(){
  37. parms="-netlog -ip=${ip} -port=${port} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=mods/@CBA_A3\;mods/@Exile\;mods/@CUP_Terrains_Core\;mods/@esseker\ -servermod=@ExileServer -bepath=${bepath} -autoinit -loadmissiontomemory"
  38. }
  39.  
  40. # ARMA 3 Modules
  41. # add mods with relative paths:
  42. # mods/\@CBA_A3\;
  43. # or several mods as:
  44. # mods/\@CBA_A3\;mods/\@task_force_radio
  45. # and chmod modules directories to 775
  46. mods=""
  47.  
  48. # Server-side Mods
  49. servermods=""
  50.  
  51. # Path to BattlEye
  52. # leave empty for default
  53. bepath=""
  54.  
  55. #### Advanced Variables ####
  56.  
  57. # Github Branch Select
  58. # Allows for the use of different function files
  59. # from a different repo and/or branch.
  60. githubuser="dgibbs64"
  61. githubrepo="linuxgsm"
  62. githubbranch="master"
  63.  
  64. # Steam
  65. # Stable
  66. appid="233780"
  67. # Development
  68. # appid="233780 -beta development"
  69.  
  70. # Server Details
  71. servicename="arma3-server"
  72. gamename="ARMA 3"
  73. engine="realvirtuality"
  74.  
  75. # Directories
  76. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  77. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  78. lockselfname=".${servicename}.lock"
  79. lgsmdir="${rootdir}/lgsm"
  80. functionsdir="${lgsmdir}/functions"
  81. filesdir="${rootdir}/serverfiles"
  82. systemdir="${filesdir}"
  83. executabledir="${filesdir}"
  84. executable="./arma3server"
  85. servercfg="config.cfg"
  86. networkcfg="basic.cfg"
  87. servercfgdir="${systemdir}/cfg"
  88. servercfgfullpath="${servercfgdir}/${servercfg}"
  89. networkcfgfullpath="${servercfgdir}/${networkcfg}"
  90. servercfgdefault="${servercfgdir}/lgsm-default.server.cfg"
  91. networkcfgdefault="${servercfgdir}/lgsm-default.network.cfg"
  92. backupdir="${rootdir}/backups"
  93.  
  94. # Logging
  95. logdays="7"
  96. #gamelogdir="" # No server logs available
  97. scriptlogdir="${rootdir}/log/script"
  98. consolelogdir="${rootdir}/log/console"
  99. consolelogging="on"
  100.  
  101. scriptlog="${scriptlogdir}/${servicename}-script.log"
  102. consolelog="${consolelogdir}/${servicename}-console.log"
  103. emaillog="${scriptlogdir}/${servicename}-email.log"
  104.  
  105. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  106. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  107.  
  108. ##### Script #####
  109. # Do not edit
  110.  
  111. # Fetches core_dl for file downloads
  112. fn_fetch_core_dl(){
  113. github_file_url_dir="lgsm/functions"
  114. github_file_url_name="${functionfile}"
  115. filedir="${functionsdir}"
  116. filename="${github_file_url_name}"
  117. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  118. # If the file is missing, then download
  119. if [ ! -f "${filedir}/${filename}" ]; then
  120. if [ ! -d "${filedir}" ]; then
  121. mkdir -p "${filedir}"
  122. fi
  123. echo -e " fetching ${filename}...\c"
  124. # Check curl exists and use available path
  125. curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  126. for curlcmd in ${curlpaths}
  127. do
  128. if [ -x "${curlcmd}" ]; then
  129. break
  130. fi
  131. done
  132. # If curl exists download file
  133. if [ "$(basename ${curlcmd})" == "curl" ]; then
  134. curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  135. if [ $? -ne 0 ]; then
  136. echo -e "\e[0;31mFAIL\e[0m\n"
  137. echo "${curlfetch}"
  138. echo -e "${githuburl}\n"
  139. exit 1
  140. else
  141. echo -e "\e[0;32mOK\e[0m"
  142. fi
  143. else
  144. echo -e "\e[0;31mFAIL\e[0m\n"
  145. echo "Curl is not installed!"
  146. echo -e ""
  147. exit 1
  148. fi
  149. chmod +x "${filedir}/${filename}"
  150. fi
  151. source "${filedir}/${filename}"
  152. }
  153.  
  154. core_dl.sh(){
  155. # Functions are defined in core_functions.sh.
  156. functionfile="${FUNCNAME}"
  157. fn_fetch_core_dl
  158. }
  159.  
  160. core_functions.sh(){
  161. # Functions are defined in core_functions.sh.
  162. functionfile="${FUNCNAME}"
  163. fn_fetch_core_dl
  164. }
  165.  
  166. core_dl.sh
  167. core_functions.sh
  168.  
  169. getopt=$1
  170. core_getopt.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement