Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
359
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.86 KB | None | 0 0
  1. #!/bin/bash
  2. # Project: Game Server Managers - LinuxGSM
  3. # Author: Daniel Gibbs
  4. # License: MIT License, Copyright (c) 2017 Daniel Gibbs
  5. # Purpose: Rust | 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.  
  11.  
  12. # Do not remove this line THAT LINE WAS NEW I TRY TO FIX THIS PROBLEM
  13.  
  14. export LD_LIBRARY_PATH="/home/rustserver/serverfiles/RustDedicated_Data/Plugins/x86_64"
  15.  
  16. # Debugging
  17. if [ -f ".dev-debug" ]; then
  18.     exec 5>dev-debug.log
  19.     BASH_XTRACEFD="5"
  20.     set -x
  21. fi
  22.  
  23. version="170501"
  24.  
  25. ##########################
  26. ######## Settings ########
  27. ##########################
  28.  
  29. #### Server Settings ####
  30.  
  31. ## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
  32. # More settings available after install in serverfiles/server/rust-server/server.cfg
  33. servername="[EU/PL]Eventis Vanilla 22.02 15:00 Full Wipe"
  34. ip="77.55.210.57"
  35. port="28015"
  36. rconport="28016"
  37. rconpassword="******"
  38. rconweb="0" # Value is: 1 for Facepunch's web panel; 0 for RCON tools like Rusty or Rustadmin
  39. maxplayers="200"
  40. # Advanced Start Settings
  41. seed="7640" #  default random; range : 1 to 2147483647 ; used to change or reproduce a procedural map
  42. worldsize="3700" # default 3000; range : 1000 to 6000 ; map size in meters
  43. saveinterval="300" # Auto-save in seconds
  44. tickrate="30" # default 30; range : 15 to 100
  45.  
  46. ## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
  47. fn_parms(){
  48. parms="-batchmode +server.ip ${ip} +server.port ${port} +server.tickrate ${tickrate} +squadmanager.squad_disable true +server.hostname \"${servername}\" +server.identity \"${servicename}\" ${conditionalseed} +server.maxplayers ${maxplayers} +server.worldsize ${worldsize} +server.saveinterval ${saveinterval} +rcon.web ${rconweb} +rcon.ip ${ip} +rcon.port ${rconport} +rcon.password \"${rconpassword}\" -logfile \"${gamelogdate}\""
  49. }
  50.  
  51. # Specific to Rust
  52. if [ -n "${seed}" ]; then
  53.     # If set, then add to start parms
  54.     conditionalseed="+server.seed ${seed}"
  55. else
  56.     # Keep randomness of the number if not set
  57.     conditionalseed=""
  58. fi
  59.  
  60. #### LinuxGSM Settings ####
  61.  
  62. ## Notification Alerts
  63. # (on|off)
  64. # Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
  65. emailalert="off"
  66. email="email@example.com"
  67. emailfrom=""
  68.  
  69. # Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
  70. pushbulletalert="off"
  71. pushbullettoken="accesstoken"
  72. channeltag=""
  73.  
  74. ## Updating | https://github.com/GameServerManagers/LinuxGSM/wiki/Update
  75. updateonstart="on"
  76.  
  77. ## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
  78. maxbackups="4"
  79. maxbackupdays="30"
  80. stoponbackup="on"
  81.  
  82. ## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
  83. consolelogging="on"
  84. logdays="7"
  85.  
  86. #### LinuxGSM Advanced Settings ####
  87.  
  88. ## SteamCMD Settings
  89. # Server appid
  90. appid="258550"
  91. # Steam App Branch Select
  92. # Allows to opt into the various Steam app branches. Default branch is "".
  93. # Example: "-beta latest_experimental"
  94. branch=""
  95.  
  96. ## Github Branch Select
  97. # Allows for the use of different function files
  98. # from a different repo and/or branch.
  99. githubuser="GameServerManagers"
  100. githubrepo="LinuxGSM"
  101. githubbranch="master"
  102.  
  103. ## LinuxGSM Server Details
  104. # Do not edit
  105. gamename="Rust"
  106. engine="unity3d"
  107.  
  108. ## Service Name | https://github.com/GameServerManagers/LinuxGSM/wiki/Multiple-Servers
  109. servicename="rust-server"
  110.  
  111. #### Directories ####
  112. # Edit with care
  113.  
  114. ## Work Directories
  115. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  116. selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
  117. lockselfname=".${servicename}.lock"
  118. lgsmdir="${rootdir}/lgsm"
  119. functionsdir="${lgsmdir}/functions"
  120. libdir="${lgsmdir}/lib"
  121. tmpdir="${lgsmdir}/tmp"
  122. filesdir="${rootdir}/serverfiles"
  123.  
  124. ## Server Specific Directories
  125. systemdir="${filesdir}"
  126. executabledir="${filesdir}"
  127. executable="./RustDedicated"
  128. serveridentitydir="${systemdir}/server/${servicename}"
  129. servercfg="server.cfg"
  130. servercfgdefault="server.cfg"
  131. servercfgdir="${serveridentitydir}/cfg"
  132. servercfgfullpath="${servercfgdir}/${servercfg}"
  133.  
  134. ## Backup Directory
  135. backupdir="${rootdir}/backups"
  136.  
  137. ## Logging Directories
  138. gamelogdir="${rootdir}/log/server"
  139. scriptlogdir="${rootdir}/log/script"
  140. consolelogdir="${rootdir}/log/console"
  141. scriptlog="${scriptlogdir}/${servicename}-script.log"
  142. consolelog="${consolelogdir}/${servicename}-console.log"
  143. emaillog="${scriptlogdir}/${servicename}-email.log"
  144.  
  145. ## Logs Naming
  146. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
  147. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
  148. gamelogdate="${gamelogdir}/${servicename}-game-$(date '+%Y-%m-%d-%H:%M:%S').log"
  149.  
  150. ########################
  151. ######## Script ########
  152. ###### Do not edit #####
  153. ########################
  154.  
  155. # Fetches core_dl for file downloads
  156. fn_fetch_core_dl(){
  157. github_file_url_dir="lgsm/functions"
  158. github_file_url_name="${functionfile}"
  159. filedir="${functionsdir}"
  160. filename="${github_file_url_name}"
  161. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${github_file_url_dir}/${github_file_url_name}"
  162. # If the file is missing, then download
  163. if [ ! -f "${filedir}/${filename}" ]; then
  164.     if [ ! -d "${filedir}" ]; then
  165.         mkdir -p "${filedir}"
  166.     fi
  167.     echo -e "    fetching ${filename}...\c"
  168.     # Check curl exists and use available path
  169.     curlpaths="$(command -v curl 2>/dev/null) $(which curl >/dev/null 2>&1) /usr/bin/curl /bin/curl /usr/sbin/curl /sbin/curl)"
  170.     for curlcmd in ${curlpaths}
  171.     do
  172.         if [ -x "${curlcmd}" ]; then
  173.             break
  174.         fi
  175.     done
  176.     # If curl exists download file
  177.     if [ "$(basename ${curlcmd})" == "curl" ]; then
  178.         curlfetch=$(${curlcmd} -s --fail -o "${filedir}/${filename}" "${githuburl}" 2>&1)
  179.         if [ $? -ne 0 ]; then
  180.             echo -e "\e[0;31mFAIL\e[0m\n"
  181.             echo "${curlfetch}"
  182.             echo -e "${githuburl}\n"
  183.             exit 1
  184.         else
  185.             echo -e "\e[0;32mOK\e[0m"
  186.         fi
  187.     else
  188.         echo -e "\e[0;31mFAIL\e[0m\n"
  189.         echo "Curl is not installed!"
  190.         echo -e ""
  191.         exit 1
  192.     fi
  193.     chmod +x "${filedir}/${filename}"
  194. fi
  195. source "${filedir}/${filename}"
  196. }
  197.  
  198. core_dl.sh(){
  199. # Functions are defined in core_functions.sh.
  200. functionfile="${FUNCNAME}"
  201. fn_fetch_core_dl
  202. }
  203.  
  204. core_functions.sh(){
  205. # Functions are defined in core_functions.sh.
  206. functionfile="${FUNCNAME}"
  207. fn_fetch_core_dl
  208. }
  209.  
  210. # Prevent from running this script as root.
  211. if [ "$(whoami)" = "root" ]; then
  212.     if [ ! -f "${functionsdir}/core_functions.sh" ]||[ ! -f "${functionsdir}/check_root.sh" ]||[ ! -f "${functionsdir}/core_messages.sh" ]||[ ! -f "${functionsdir}/core_exit.sh" ]; then
  213.         echo "[ FAIL ] Do NOT run this script as root!"
  214.         exit 1
  215.     else
  216.         core_functions.sh
  217.         check_root.sh
  218.     fi
  219. fi
  220.  
  221. core_dl.sh
  222. core_functions.sh
  223. getopt=$1
  224. core_getopt.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement