4
0

arkserver 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/bash
  2. # ARK: Survivial Evolved
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. version="121215"
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Steam login
  13. steamuser="anonymous"
  14. steampass=""
  15. # Start Variables
  16. ip="0.0.0.0"
  17. updateonstart="off"
  18. fn_parms(){
  19. parms="TheIsland?listen"
  20. }
  21. #### Advanced Variables ####
  22. # Github Branch Select
  23. # Allows for the use of different function files
  24. # from a different repo and/or branch.
  25. githubuser="dgibbs64"
  26. githubrepo="linuxgsm"
  27. githubbranch="master"
  28. # Steam
  29. appid="376030"
  30. # Server Details
  31. servicename="ark-server"
  32. gamename="ARK: Survivial Evolved"
  33. engine="unreal4"
  34. # Directories
  35. rootdir="$(dirname $(readlink -f "${BASH_SOURCE[0]}"))"
  36. selfname=$(basename $(readlink -f "${BASH_SOURCE[0]}"))
  37. lockselfname=".${servicename}.lock"
  38. filesdir="${rootdir}/serverfiles"
  39. systemdir="${filesdir}/ShooterGame"
  40. executabledir="${systemdir}/Binaries/Linux"
  41. executable="./ShooterGameServer"
  42. servercfgdir="${systemdir}/Saved/Config/LinuxServer"
  43. servercfg="GameUserSettings.ini"
  44. servercfgfullpath="${servercfgdir}/${servercfg}"
  45. servercfgdefault="${servercfgdir}/lgsm-default.ini"
  46. backupdir="${rootdir}/backups"
  47. # Logging
  48. logdays="7"
  49. gamelogdir="${systemdir}/logs"
  50. scriptlogdir="${rootdir}/log/script"
  51. consolelogdir="${rootdir}/log/console"
  52. scriptlog="${scriptlogdir}/${servicename}-script.log"
  53. consolelog="${consolelogdir}/${servicename}-console.log"
  54. emaillog="${scriptlogdir}/${servicename}-email.log"
  55. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  56. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  57. ##### Script #####
  58. # Do not edit
  59. fn_getgithubfile(){
  60. filename=$1
  61. exec=$2
  62. fileurl=${3:-$filename}
  63. filepath="${rootdir}/${filename}"
  64. filedir=$(dirname "${filepath}")
  65. # If the function file is missing, then download
  66. if [ ! -f "${filepath}" ]; then
  67. if [ ! -d "${filedir}" ]; then
  68. mkdir "${filedir}"
  69. fi
  70. githuburl="https://raw.githubusercontent.com/${githubuser}/${githubrepo}/${githubbranch}/${fileurl}"
  71. echo -e " fetching ${filename}...\c"
  72. if [ "$(command -v curl)" ]||[ "$(which curl >/dev/null 2>&1)" ]||[ -f "/usr/bin/curl" ]||[ -f "/bin/curl" ]; then
  73. :
  74. else
  75. echo -e "\e[0;31mFAIL\e[0m\n"
  76. echo "Curl is not installed!"
  77. echo -e ""
  78. exit
  79. fi
  80. curl=$(curl --fail -o "${filepath}" "${githuburl}" 2>&1)
  81. if [ $? -ne 0 ]; then
  82. echo -e "\e[0;31mFAIL\e[0m\n"
  83. echo " ${curl}"|grep "curl:"
  84. echo -e "${githuburl}\n"
  85. exit
  86. else
  87. echo -e "\e[0;32mOK\e[0m"
  88. fi
  89. if [ "${exec}" ]; then
  90. chmod +x "${filepath}"
  91. fi
  92. fi
  93. if [ "${exec}" ]; then
  94. source "${filepath}"
  95. fi
  96. }
  97. fn_runfunction(){
  98. fn_getgithubfile "functions/${functionfile}" 1
  99. }
  100. fn_functions(){
  101. # Functions are defined in fn_functions.
  102. functionfile="${FUNCNAME}"
  103. fn_runfunction
  104. }
  105. fn_functions
  106. getopt=$1
  107. fn_getopt