sbserver 2.1 KB

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