Restart on crash

Discussion in 'Server & Community Management' started by AgentLV, Apr 26, 2015.

  1. Ok, what does it do?
     
  2. Thx, now can anyone help me?
     
  3. I wish I could , unfortunately I can just guess.
    The script runs well on /restart, but does not on a crash. So it seems like Spigot is unable to run the script when needed. Do you have some console output of a crash?


    Krauti
     
  4. Can someone maybe tell me how to kill a server process in a script?
     
  5. Any serious answers?
     
  6. Well how do you kill your process without a script? Use the same commands.
    I don't know which process you want to kill but my guess is the java process of the Minecraft server.
    Identify the PID by using ps and filter the output with awk, sed or any other tools you like and put it into a variable like $pid
    Then kill $pid.
    If the server process hung up you may need to use kill -9 to send SIGKILL but there WILL be data loss.

    The more elegant way would be to send the stop signal to your screen session. Something like
    screen -S minecraft -p minecraft -X stuff "stop"`echo -ne '\015'`
     
    #29 Krauti2, May 25, 2015
    Last edited: May 25, 2015
  7. so, I know i'm necroing. Kinda. It's hard to necro an unresolved topic though. I've looked everywhere for a script to put in my start.sh file that would restart the server when it's crashed. And I think he's looking for the same thing. Giving that the original author still owns a server, I would like to continue this, mainly for me, obviously (because I would guess he figured it out, or doesn't own server any more). I use spigot, at this point 1.10 (I think he was using 1.8 when he wrote this. wow. I have in my spigot.yml file:
    restart-on-crash: true
    restart-script: start.sh
    So, when writing my restart script (i know nothing about this, only recently started learning java) it looks like this.
    while true
    do
    java -jar Spigot.jar
    done
    But i don't think that's right. anyone seeing something new since the last post? I know that this would help maannnyy people, as I can't find crap online. A year and half later, and still nothing online about this same issue. someone needs to do a really good tutorial video on it. Or link me to one that I may have missed. Thank you everyone!
     
  8. That is correct

    Code (Text):
    while true
    do
    java -jar Spigot.jar
    done
     
  9. So, I put this, and only this in my start.sh file. Then I set my start folder (in spigot.yml) to start.sh. and this should restart the server when it crashes?
     
  10. Yes and Yes but you should really use a webpanel like MultiCraft to reboot on a serious error.
     
  11. Well, I use server.pro. I just need something that will restart my server in any case that it goes down, without me pressing "stop". i'm in the navy, and I deploy this week, so I want the people who play on there to not worry about it coming back up, or me paying for a dead server while i'm gone. Any suggestions?
     
  12. hmm I have never used server.pro myself but your there might be a option in the cpanel to reboot the server when it crashes. But using this
    Code (Text):

    while true
    do
    java -jar Spigot.jar
    done
     
    it will just loop constantly and keep trying to start the server if the Spigot.jar stops but if the error is happening when your server is starting it will not come backup it will just be in a infinite loop. You should have a staff member that has cpanel access so they can fix these errors if one should occur. Also start your server with start.sh which should contain the script above you can test this by typing /stop in-game or in console and the server should start up again.
     
  13. Great advise. it still doesn't work for me though. :( i've emailed the server.pro service team, hope they can help. if I find out anything, I'll be sure to update this forum, because it is still a very wide, an common problem with new server owners. Thank you!
     
  14. Just this :
    Code (Text):
    screen -dmS survie java -Xmx8G -Xmx8G -jar spigot_server.jar nogui
    And change "survie" by the name of your server and 8G bay what you want, 2G - 5G .... its the RAM.

    And try a restart of your server.
     
  15. From what I have read he does not have ssh access to the server
     
  16. it does not need ssh access only to this single control line in the file start.sh
     
  17. i know the post is old but haven't found a fix posted any where and its allot simpler then you might think ..
    just tell it to sleep for a few seconds giving spigot time to restart before the screen closes.. DONE!

    here is my setup:

    "start.sh"
    Code (Text):
    #!/bin/bash
    screen -dmS minecraft ~/minecraft/spigot/./serverstart.sh
    "serverstart.sh"
    Code (Text):
    #!/bin/bash
    cd ~/minecraft/spigot
    java -Xmx1024M -Xms1024M -jar spigot-1.12.2.jar
    sleep 3