Advertisement
Guest User

Untitled

a guest
Apr 21st, 2016
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.37 KB | None | 0 0
  1. #!/bin/bash
  2. # Rust
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Contributor: UltimateByte (LGSM adaptation), Wulf (Information)
  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="230215"
  14.  
  15. #### Variables ####
  16.  
  17. # Notification Email
  18. # (on|off)
  19. emailnotification="off"
  20. email="email@example.com"
  21.  
  22. # Steam login (not required)
  23. steamuser="anonymous"
  24. steampass=""
  25.  
  26. # Server settings
  27. # More settings available after install in serverfiles/server/rust-server/server.cfg
  28. servername="The Rustarians | FULL WIPE 21-04 | Very Active Admins | NO LAG | Beginners Welcome |"
  29. ip="151.80.110.111"
  30. updateonstart="off"
  31. port="28015"
  32. rconport="28016"
  33. rconpassword=""
  34. maxplayers="300"
  35.  
  36. # Advanced
  37. seed="45" # default random; range : -2147483647 to 2147483647 ; used to change or reproduce a procedural map
  38. worldsize="4000" # default 4000; range : 2000 to 8000 ; map size in meters
  39. saveinterval="300" # Auto-save in seconds
  40. tickrate="30" # default 30; range : 15 to 100
  41.  
  42. # https://developer.valvesoftware.com/wiki/Rust_Dedicated_Server
  43. fn_parms(){
  44. parms="-batchmode +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +server.hostname \"${servername}\" +server.identity \"${servicename}\" ${conditionalseed} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile ${gamelogfile}"
  45. }
  46.  
  47. # Specific to Rust
  48. if [ -n "${seed}" ]; then
  49. # If set, then add to start parms
  50. conditionalseed="+server.seed ${seed}"
  51. else
  52. # Keep randomness of the number if not set
  53. conditionalseed=""
  54. fi
  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. appid="258550"
  67.  
  68. # Server Details
  69. servicename="rust-server"
  70. gamename="Rust"
  71. engine="unity3d"
  72.  
  73. # Directories
  74. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  75. selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
  76. lockselfname=".${servicename}.lock"
  77. filesdir="${rootdir}/serverfiles"
  78. systemdir="${filesdir}"
  79. executabledir="${filesdir}"
  80. executable="./RustDedicated"
  81. serveridentitydir="${systemdir}/server/${servicename}"
  82. servercfg="server.cfg"
  83. servercfgdir="${serveridentitydir}/cfg"
  84. servercfgfullpath="${servercfgdir}/${servercfg}"
  85. servercfgdefault="${servercfgdir}/lgsm-default.cfg"
  86. backupdir="${rootdir}/backups"
  87.  
  88. # Logging
  89. logdays="7"
  90. gamelogdir="${rootdir}/log/server"
  91. scriptlogdir="${rootdir}/log/script"
  92. consolelogdir="${rootdir}/log/console"
  93.  
  94. gamelog="${gamelogdir}/${servicename}-game.log"
  95. scriptlog="${scriptlogdir}/${servicename}-script.log"
  96. consolelog="${consolelogdir}/${servicename}-console.log"
  97. emaillog="${scriptlogdir}/${servicename}-email.log"
  98. gamelogfile="\"gamelog-$(date '+%Y-%m-%d-%H-%M-%S').log\""
  99.  
  100. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  101. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  102.  
  103. ##### Script #####
  104. # Do not edit
  105.  
  106. fn_getgithubfile(){
  107. filename=$1
  108. exec=$2
  109. fileurl=${3:-$filename}
  110. filepath="${rootdir}/${filename}"
  111. filedir=$(dirname "${filepath}")
  112. # If the function file is missing, then download
  113. if [ ! -f "${filepath}" ]; then
  114. if [ ! -d "${filedir}" ]; then
  115. mkdir "${filedir}"
  116. fi
  117. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  118. echo -e " fetching ${filename}...\c"
  119. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  120. :
  121. else
  122. echo -e "\e[0;31mFAIL\e[0m\n"
  123. echo "Curl is not installed!"
  124. echo -e ""
  125. exit
  126. fi
  127. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  128. if [ $? -ne 0 ]; then
  129. echo -e "\e[0;31mFAIL\e[0m\n"
  130. echo " ${curl}"|grep "curl:"
  131. echo -e "${githuburl}\n"
  132. exit
  133. else
  134. echo -e "\e[0;32mOK\e[0m"
  135. fi
  136. if [ "${exec}" ]; then
  137. chmod +x "${filepath}"
  138. fi
  139. fi
  140. if [ "${exec}" ]; then
  141. source "${filepath}"
  142. fi
  143. }
  144.  
  145. fn_runfunction(){
  146. fn_getgithubfile "functions/${functionfile}" 1
  147. }
  148.  
  149. core_functions.sh(){
  150. # Functions are defined in core_functions.sh.
  151. functionfile="${FUNCNAME}"
  152. fn_runfunction
  153. }
  154.  
  155. core_functions.sh
  156.  
  157. getopt=$1
  158. core_getopt.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement