Advertisement
Guest User

ServerStart.sh

a guest
Feb 7th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. # Fix work directory
  4. # Some GUIs set wrong working directory which breaks relative paths
  5. cd -- "$(dirname "$0")"
  6.  
  7. # makes things easier if script needs debugging
  8. if [ x${FTB_VERBOSE} = xyes ]; then
  9. set -x
  10. fi
  11.  
  12. # Read pack related settings from external setting file
  13. . ./settings.sh
  14.  
  15. # Read settings defined by local server admin
  16. if [ -f settings-local.sh ]; then
  17. . ./settings-local.sh
  18. fi
  19.  
  20. # cleaner code
  21. eula_false() {
  22. grep -q 'eula=false' eula.txt
  23. return $?
  24. }
  25.  
  26. # cleaner code 2
  27. start_server() {
  28. "$JAVACMD" -server -Xms${MIN_RAM} -Xmx${MAX_RAM} -XX:PermSize=${PERMGEN_SIZE} ${JAVA_PARAMETERS} -jar ${FORGEJAR} nogui
  29. }
  30.  
  31. # run install script if MC server or launchwrapper s missing
  32. if [ ! -f ${JARFILE} -o ! -f libraries/${LAUNCHWRAPPER} ]; then
  33. echo "Missing required jars. Running install script!"
  34. sh ./FTBInstall.sh
  35. fi
  36.  
  37. # check eula.txt
  38. if [ -f eula.txt ] && eula_false ; then
  39. echo "Make sure to read eula.txt before playing!"
  40. echo "To exit press <enter>"
  41. read ignored
  42. exit
  43. fi
  44.  
  45. # if eula.txt is missing inform user and start MC to create eula.txt
  46. if [ ! -f eula.txt ]; then
  47. echo "Missing eula.txt. Startup will fail and eula.txt will be created"
  48. echo "Make sure to read eula.txt before playing!"
  49. echo "To continue press <enter>"
  50. read ignored
  51. fi
  52.  
  53. echo "Starting server"
  54. rm -f autostart.stamp
  55. start_server
  56.  
  57. while [ -e autostart.stamp ] ; do
  58. rm -f autostart.stamp
  59. echo "If you want to completely stop the server process now, press Ctrl+C before the time is up!"
  60. for i in 5 4 3 2 1; do
  61. echo "Restarting server in $i"
  62. sleep 1
  63. done
  64. echo "Rebooting now!"
  65. start_server
  66. echo "Server process finished"
  67. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement