Crash Detection

Discussion in 'Archived: Plugin Requests' started by number1_Master, Jul 19, 2012.

  1. Offline

    number1_Master

    Plugin category: [ADMN] or [MISC]

    Suggested name: CrashRestart (but really, name it whatever you would like :) )

    Commands: I can't think of any commands, but if you do, then go ahead add it.

    Permissions: Permissions aren't necessary, but if you make a command, go ahead add one.

    What I would like: As seen with RemoteToolkit, a plugin can detect when a server gives a severe error / crashes, then restart the server automatically. I do use RemoteToolkit myself, but it has tons of features that I do not use. I'd prefer something a little lightweight, if that can be done.
    So, can a plugin developer make a plugin that detects a severe error / crash for me? If necessary, I can help you (figuring out this for myself is overwhelming). Thank you.

    When I'd like it by: Anytime before the Minecraft 1.3 (August 1st is planned deadline) is fine.
     
    np98765 likes this.
  2. Offline

    number1_Master

    I'm assuming this won't be created since it is complicated...
     
  3. Offline

    Ne0nx3r0

    This would be useful, I've had a server hang multiple times and had to reset it manually... It's probably not that complicated.
     
    nunber1_Master likes this.
  4. Offline

    np98765

    Yeah, it's extremely of annoying... The server just lags out and sits there.
     
    nunber1_Master likes this.
  5. Offline

    number1_Master

    O.K. I developed a startup script which startsup the server. Then, whenever the server stops, the console gives you 10 seconds to type CTRL+C (this stops the process). If you do not, then the server startsup again.
    I think this is the solution to the crash detection because I believe craftbukkit already stops the server on a severe error (can someone confirm this?). Since I'm a Mac, I wrote the script for Mac. I believe you don't have to change too much for it to work on Linux. As for Windows, this will be different.
    Script:
    Code:
    #!/bin/sh
     
    cd //The rest of your directory goes here! Example: /Users/number1_Master/Desktop/Server/
    java -Xms[RAM]M -Xmx[RAM]M -jar craftbukkit.jar -nojline //Replace [RAM] with your desired amount
     
    while true
    do
    echo "============================================="
    echo "To stop, hold down CTRL and C ( CTRL+C )!"
    echo "10 seconds until auto startup!"
    sleep 5
    echo "You have 5 more seconds!"
    sleep 2
    echo "3 ..."
    sleep 1
    echo "2 ..."
    sleep 1
    echo "1 ..."
    sleep 1
    echo "Your Minecraft Server is starting up ..."
    echo "============================================="
     
    java -Xms[RAM]M -Xmx[RAM]M -jar craftbukkit.jar -nojline //Replace [RAM] with your desired amount
     
    done
     
  6. Offline

    Ne0nx3r0

    Well I have a script that handles this issue, my problem is when the server hangs but doesn't "shut down".

    That is a good solution though.
     
    nunber1_Master likes this.
  7. Offline

    np98765

    Same here. Is "hang" the more accepted term? I just say "lag out". :p

    Tends to happen with WorldEdit and TNT.
     
  8. Offline

    r0306

    nunber1_Master
    I don't believe that this can be accomplished with a plugin as the plugin runs on the server itself whereas an external program such as RemoteToolKit can because it is running on the OS itself, not the server and is not affected by the crash. If the server is affected, the plugins will stop responding just like the server and will not be able to restart. In fact, I don't even believe that a plugin can start a server up once it's completely stopped.
     
  9. Offline

    -_Husky_-

    I could make a plugin that runs a program in the main directory when the server shuts down, want it?
     
    nunber1_Master likes this.
  10. Offline

    np98765

    Could you have an external plugin that pings the server every so often? And if the server is hanging, then it would end the process and start the server up?
     
  11. Offline

    -_Husky_-

    Yeah, the plugin would call the program, because if the server is frozen, then the plugins are, too.

    How it would work:

    On plugin startup, it calls a program to run, the program will stay running, until the server crashes, (it would continuely ping it every 5 seconds or so) it would then issue a stop. Then reboot, and kill the program

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  12. Offline

    np98765

    Issuing a stop doesn't work if the server is frozen. The whole process has to be ended entirely. On my Mac, I have to Force Quit the org.bukkit.craftbukkit.Main before starting the server again.

    EDIT: Read it again... Issue a stop, then reboot, then kill? How about just kill and reboot? :p
     
  13. Offline

    -_Husky_-

    Well, the program would need to be killed otherwise it would continue running, and have multiple instances running at once, all doing the same job, so it would restart the server a thousand times
     
  14. Offline

    np98765

    Oh, you meant stop the program... I thought you meant run 'stop' from the console. -_- :p
     
    nunber1_Master and -_Husky_- like this.
  15. Offline

    number1_Master

    Well by a plugin, that is what I meant.
    That is pretty much what I was thinking!

    np98765 Ne0nx3r0 Ya, there still needs to be a work around for freezes. I'm only so smart.
     
  16. nunber1_Master likes this.
  17. Offline

    number1_Master

    -_Husky_- You still going to do that plugin or you don't have time (just curious)?
     
  18. Offline

    -_Husky_-

    Oh, I'll do it now'ish nunber1_Master

    All Done, Only works on Windows (for now..)

    Download: https://dl.dropbox.com/u/51143191/ServerReboot.rar

    Instructions:
    ~~How to use~~

    - Put the ServerReboot.jar in the main directory of your server,
    Then put the ServerRebootPlugin.jar into the plugins Directory..

    Boot up your server, And All done,

    Notes: this plugin will only Run the 'Run.bat' file, Please don't use any other names.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
    nunber1_Master likes this.
  19. Offline

    number1_Master

    Anything I can do to help you convert it to Mac?

    EDIT: I checked out the code. Maybe there can be a config file to name the startup script? Otherwise, there would need to be a different .jar for each script.

    EDIT: And if the server is frozen ... then wouldn't this code open a new window ... and the frozen server would still be up in the old window?
     
  20. Offline

    -_Husky_-

    config file, Will work on it.

    I've Converted it to mac and linux

    if the server is frozen, It wont do anything, It'll only work when the server crashes.

    I'll add a few things, (Like a freeze detector) and a config soon.

    https://dl.dropbox.com/u/51143191/ServerReboot.zip

    Instructions in the .zip.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 27, 2016
  21. Offline

    number1_Master

    Code:
    #!/bin/sh
     
    cd //The rest of your directory goes here! Example: /Users/number1_Master/Desktop/Server/
    java -Xms[RAM]M -Xmx[RAM]M -jar craftbukkit.jar -nojline //Replace [RAM] with your desired amount
     
    while true
    do
    echo "============================================="
    echo "To stop, hold down CTRL and C ( CTRL+C )!"
    echo "10 seconds until auto startup!"
    sleep 5
    echo "You have 5 more seconds!"
    sleep 2
    echo "3 ..."
    sleep 1
    echo "2 ..."
    sleep 1
    echo "1 ..."
    sleep 1
    echo "Your Minecraft Server is starting up ..."
    echo "============================================="
     
    java -Xms[RAM]M -Xmx[RAM]M -jar craftbukkit.jar -nojline //Replace [RAM] with your desired amount
     
    done
    That script above is what I use (at the moment) whenever the server stops (crashes). Your plugin does the same, but in Java. If you add freeze detector and config, that would make your plugin amazing (also, make your plugin public, it should get a lot of downloads).

    Thanks man, you are the best!
     
    -_Husky_- likes this.

Share This Page