AutoRestart Server Help! (Lib's Hunger Games)

Discussion in 'Server & Community Management' started by Hectic_Will, May 14, 2013.

  1. Hello!

    I am using the latest Snapshot version of Spigot (1.5.2 Snapshot), and I was wondering how i could auto-restart my server every time is shut down? I am using libraryaddict's Hunger Games and every time a game ends, I want the server/console to start the server up again!

    If you can help, please comment below! - Thanks
  2. md_5

    Administrator Developer

  3. YoFuzzy3


    Use this startup script. Obvisouly change the line with the java arguments to your own.
    Code (Text):
    echo "----------------"
    echo "Launching..."
    echo "----------------"
    BINDIR=$(dirname "$(readlink -fn "$0")")
    cd "$BINDIR"
    while : ; do
      echo "----------------"
      echo "Starting up..."
      echo "----------------"
      sleep 1
    java -Xincgc -Xms1G -Xmx8G -jar Spigot-850.jar
      echo "Restarting in 3 seconds, or press CTRL + C to cancel."
      sleep 1
      echo "Restarting in 2 seconds, or press CTRL + C to cancel."
      sleep 1
      echo "Restarting in 1 second, or press CTRL + C to cancel."
      sleep 1
  4. You can also use Minecraft Remote Toolkit! It has a bunch of different features that could help later. If you want to find it GIYF
  5. Thanks for the helpful responses guys!
  6. Code (Text):
    while true
    echo "###LazleCraft Event Server###"
    echo "##########STARTING###########"
    java -Xmx1224M -XX:ParallelGCThreads=8 -server -Xincgc -jar event.jar nogui
    echo "Server will restart soon, fully stop the server by pressing CTRL + C"
    echo "Restarting in:"
    for i in 5 4 3 2 1
    echo "$i..."
    sleep 1
    echo "Server Restarting!"
  7. Can you tell me which file I have to put this in? I can't seem to find it.
  8. YoFuzzy3


    It's a startup script, use it instead of your normal startup script. Replace the line that starts with "java" with your normal java arguments that you would use to start your own server.
  9. What I need to do to auto-restart on linux CentOS?
  10. Use the start up scripts above.
  11. And for hosted servers?
  12. YoFuzzy3


    If you're using Multicraft I believe you can get a task to run a start command every 1 minute.
  13. Thanks for this, just what I was looking for.
  14. If this doesn't work for anyone, I have the ultimate solution
    (Works For Windows 7)
    just put this before the
    "PAUSE" at the end of the code
    This is what is should look like:

    java -Xms[RAM in MB]M -Xms[RAM in MB]M -jar spigot.jar -o true
    RUN [run.bat file location]

    However just be warned that this will force your server to start every time it is stopped by just about anything
    (I don't think this includes crashes)

    Btw you write this in the run.bat file or what ever you use to run the server
  15. joehot200


    What? All that does it pauses it.
    If you want an infinite loop in windows, just use goto.

    java -jar spergit.jar
    goto :loop