sbserver 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #!/bin/bash
  2. # Starbound
  3. # Server Management Script
  4. # Author: Daniel Gibbs
  5. # Website: http://gameservermanagers.com
  6. version="040715"
  7. #### Variables ####
  8. # Notification Email
  9. # (on|off)
  10. emailnotification="off"
  11. email="email@example.com"
  12. # Steam login
  13. steamuser="username"
  14. steampass="password"
  15. # Start Variables
  16. ip="0.0.0.0"
  17. updateonstart="no"
  18. fn_parms(){
  19. parms=""
  20. }
  21. #### Advanced Variables ####
  22. # Steam
  23. appid="211820"
  24. # Server Details
  25. servicename="sb-server"
  26. gamename="Starbound"
  27. engine="starbound"
  28. # Directories
  29. rootdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  30. selfname="$(basename $0)"
  31. lockselfname=".${servicename}.lock"
  32. filesdir="${rootdir}/serverfiles"
  33. systemdir="${filesdir}"
  34. executabledir="${filesdir}/linux64"
  35. executable="./starbound_server"
  36. servercfg="sbboot.config"
  37. servercfgdir="${executabledir}"
  38. servercfgfullpath="${servercfgdir}/${servercfg}"
  39. backupdir="${rootdir}/backups"
  40. # Logging
  41. logdays="7"
  42. gamelogdir="${filesdir}/giraffe_storage"
  43. scriptlogdir="${rootdir}/log/script"
  44. consolelogdir="${rootdir}/log/console"
  45. scriptlog="${scriptlogdir}/${servicename}-script.log"
  46. consolelog="${consolelogdir}/${servicename}-console.log"
  47. emaillog="${scriptlogdir}/${servicename}-email.log"
  48. scriptlogdate="${scriptlogdir}/${servicename}-script-$(date '+%d-%m-%Y-%H-%M-%S').log"
  49. consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%d-%m-%Y-%H-%M-%S').log"
  50. ##### Script #####
  51. # Do not edit
  52. fn_runfunction(){
  53. # Functions are downloaded and run with this function
  54. if [ ! -f "${rootdir}/functions/${functionfile}" ]; then
  55. cd "${rootdir}"
  56. if [ ! -d "functions" ]; then
  57. mkdir functions
  58. fi
  59. cd functions
  60. echo -e " loading ${functionfile}...\c"
  61. wget -N /dev/null https://raw.githubusercontent.com/dgibbs64/linuxgsm/master/functions/${functionfile} 2>&1 | grep -F HTTP | cut -c45-
  62. chmod +x "${functionfile}"
  63. cd "${rootdir}"
  64. fi
  65. source "${rootdir}/functions/${functionfile}"
  66. }
  67. fn_functions(){
  68. # Functions are defined in fn_functions.
  69. functionfile="${FUNCNAME}"
  70. fn_runfunction
  71. }
  72. fn_functions
  73. getopt=$1
  74. fn_getopt