Advertisement
Guest User

Untitled

a guest
Jan 6th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.22 KB | None | 0 0
  1. #!/bin/bash
  2. # Project: Game Server Managers - LinuxGSM
  3. # Author: Daniel Gibbs
  4. # License: MIT License, Copyright (c) 2016 Daniel Gibbs
  5. # Purpose: ARMA 3 | Server Management Script
  6. # Contributors: https://github.com/GameServerManagers/LinuxGSM/graphs/contributors
  7. # Documentation: https://github.com/GameServerManagers/LinuxGSM/wiki
  8. # Website: https://gameservermanagers.com
  9.  
  10. # Debugging
  11. if [ -f ".dev-debug" ]; then
  12. exec 5>dev-debug.log
  13. BASH_XTRACEFD="5"
  14. set -x
  15. fi
  16.  
  17. version="161224"
  18.  
  19. ##########################
  20. ######## Settings ########
  21. ##########################
  22.  
  23. #### Server Settings ####
  24.  
  25. ## SteamCMD Login | https://github.com/GameServerManagers/LinuxGSM/wiki/SteamCMD#steamcmd-login
  26. steamuser="protomiam"
  27. steampass="Jben25430"
  28.  
  29. ## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
  30. ip="0.0.0.0"
  31. port="2302"
  32.  
  33. ## ARMA 3 Modules
  34. # Add mods with relative paths:
  35. # mods/@cba_a3
  36. # To load the "Community Base Addons v3" module found in the
  37. # directory serverfiles/mods/@cba_a3. Load several mods as:
  38. # mods="mods/@ace\;mods/@acex\;mods/@cba_a3"
  39. mods=""
  40.  
  41. ## Server-side Mods
  42. servermods="\@extDB2\;\@life_server\;\@LEDG"
  43.  
  44. ## Path to BattlEye
  45. # Leave empty for default
  46. bepath=""
  47.  
  48. ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
  49. # Edit with care
  50. fn_parms(){
  51. parms="-netlog -ip=${ip} -port=${port} -cfg=${networkcfgfullpath} -config=${servercfgfullpath} -mod=${mods} -servermod=${servermods} -bepath=${bepath} -autoinit -loadmissiontomemory"
  52. }
  53.  
  54. #### LinuxGSM Settings ####
  55.  
  56. ## Notification Alerts
  57. # (on|off)
  58. # Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
  59. emailalert="off"
  60. email="email@example.com"
  61. emailfrom=""
  62.  
  63. # Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
  64. pushbulletalert="off"
  65. pushbullettoken="accesstoken"
  66. channeltag=""
  67.  
  68. ## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
  69. updateonstart="off"
  70.  
  71. ## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
  72. maxbackups="4"
  73. maxbackupdays="30"
  74. stoponbackup="on"
  75.  
  76. ## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
  77. consolelogging="on"
  78. logdays="7"
  79.  
  80. #### LinuxGSM Advanced Settings ####
  81.  
  82. ## SteamCMD Settings
  83. # Server appid
  84. appid="233780"
  85. # Steam App Branch Select
  86. # Allows to opt into the various Steam app branches. Default branch is "".
  87. # Example: "-beta latest_experimental"
  88. branch=""
  89.  
  90. ## Github Branch Select
  91. # Allows for the use of different function files
  92. # from a different repo and/or branch.
  93. githubuser="GameServerManagers"
  94. githubrepo="LinuxGSM"
  95. githubbranch="master"
  96.  
  97. ## LinuxGSM Server Details
  98. # Do not edit
  99. gamename="ARMA 3"
  100. engine="realvirtuality"
  101.  
  102. ## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
  103. servicename="arma3-server"
  104.  
  105. #### Directories ####
  106. # Edit with care
  107.  
  108. ## Work Directories
  109. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  110. selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  111. lockselfname=".${servicename}.lock"
  112. lgsmdir="${rootdir}/lgsm"
  113. functionsdir="${lgsmdir}/functions"
  114. libdir="${lgsmdir}/lib"
  115. tmpdir="${lgsmdir}/tmp"
  116. filesdir="${rootdir}/serverfiles"
  117.  
  118. ## Server Specific Directories
  119. systemdir="${filesdir}"
  120. executabledir="${filesdir}"
  121. executable="./arma3server"
  122. servercfg="${servicename}.server.cfg"
  123. networkcfg="${servicename}.network.cfg"
  124. servercfgdefault="server.cfg"
  125. networkcfgdefault="network.cfg"
  126. servercfgdir="${systemdir}/cfg"
  127. servercfgfullpath="${servercfgdir}/${servercfg}"
  128. networkcfgfullpath="${servercfgdir}/${networkcfg}"
  129.  
  130. ## Backup Directory
  131. backupdir="${rootdir}/backups"
  132.  
  133. ## Logging Directories
  134. #gamelogdir="" # No server logs available
  135. scriptlogdir="${rootdir}/log/script"
  136. consolelogdir="${rootdir}/log/console"
  137. scriptlog="${scriptlogdir}/${servicename}-script.log"
  138. consolelog="${consolelogdir}/${servicename}-console.log"
  139. emaillog="${scriptlogdir}/${servicename}-email.log"
  140.  
  141. ## Logs Naming
  142. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
  143. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
  144.  
  145. ########################
  146. ######## Script ########
  147. ###### Do not edit #####
  148. ########################
  149.  
  150. # Fetches core_dl for file downloads
  151. fn_fetch_core_dl(){
  152. github_file_url_dir="lgsm/functions"
  153. github_file_url_name="${functionfile}"
  154. filedir="${functionsdir}"
  155. filename="${github_file_url_name}"
  156. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  157. # If the file is missing, then download
  158. if [ ! -f "${filedir}/${filename}" ]; then
  159. if [ ! -d "${filedir}" ]; then
  160. mkdir -p "${filedir}"
  161. fi
  162. echo -e " fetching ${filename}...\c"
  163. # Check curl exists and use available path
  164. curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  165. for curlcmd in ${curlpaths}
  166. do
  167. if [ -x "${curlcmd}" ]; then
  168. break
  169. fi
  170. done
  171. # If curl exists download file
  172. if [ "$(basename ${curlcmd})" == "curl" ]; then
  173. curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  174. if [ $? -ne 0 ]; then
  175. echo -e "\e[0;31mFAIL\e[0m\n"
  176. echo "${curlfetch}"
  177. echo -e "${githuburl}\n"
  178. exit 1
  179. else
  180. echo -e "\e[0;32mOK\e[0m"
  181. fi
  182. else
  183. echo -e "\e[0;31mFAIL\e[0m\n"
  184. echo "Curl is not installed!"
  185. echo -e ""
  186. exit 1
  187. fi
  188. chmod +x "${filedir}/${filename}"
  189. fi
  190. source "${filedir}/${filename}"
  191. }
  192.  
  193. core_dl.sh(){
  194. # Functions are defined in core_functions.sh.
  195. functionfile="${FUNCNAME}"
  196. fn_fetch_core_dl
  197. }
  198.  
  199. core_functions.sh(){
  200. # Functions are defined in core_functions.sh.
  201. functionfile="${FUNCNAME}"
  202. fn_fetch_core_dl
  203. }
  204.  
  205. # Prevent from running this script as root.
  206. if [ "$(whoami)" = "root" ]; then
  207. if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then
  208. echo "[ FAIL ] Do NOT run this script as root!"
  209. exit 1
  210. else
  211. core_functions.sh
  212. check_root.sh
  213. fi
  214. fi
  215.  
  216. core_dl.sh
  217. core_functions.sh
  218. getopt=$1
  219. core_getopt.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement