Restart server upon crash.

Discussion in 'Spigot Plugin Development' started by fujiboy4, Dec 16, 2015.

  1. Hello! :D
    I need some help making a start.sh file. I honestly have no idea what im supposed to put in the .sh file to make it restart the server if it crashes. Please help! Thanks.
     
  2. Inkzzz

    Resource Staff

    Code (Text):
    #!/bin/sh
    while true
    do
    java -Xmx3G -Xms3G -jar spigot.jar
    echo "If you want to completely stop the server process now, press Ctrl+C before
    the time is up!"
    echo "Rebooting in:"
    for i in 5 4 3 2 1
    do
    echo "$i..."
    sleep 1
    done
    echo "Rebooting now!"
    done
     
    • Like Like x 1
  3. If you use a script like that, make sure you disable the built-in auto-restart in spigot.yml.

    Bad things will happen when both of them fire, you'll get two instances of spigot trying to run at once.
     
    • Agree Agree x 1
  4. What should I name the file? And is it this line where i disable autorestart?

    Code (Text):
      restart-on-crash: true
      restart-script: ./start.sh
     
  5. Yes, that's the line- set that to false if you want to have the auto-restart in your start.sh. if it's set to false it doesn't matter what you put in restart-script.