Advertisement
Guest User

Untitled

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