Advertisement
Guest User

Untitled

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