Crash Restarter
Does your server crash randomly and unexpectedly? Use this plugin to Detect if your server has Crashed!
This plugin will restart your server within 1 minute of it crashing.
My server would crash every couple of hours, and if I/an Admin wasn't online it would stay down for multiple hours. So i decide to write this plugin.
V2.0+
NEW WAY OF DETECTION!
This version gets rid of the old code of it being based on player interactions etc. I've been searching and testing for a very long time I've finally figured it out! It can be done!
How it now works
When your server crashes, it stops all plugins(even the old version of this plugin). But after a long hard struggle to find a way, I have finally figured it out! When the server crashes the main part of this plugin stops working, which stops triggering the external part of the plugin, which in turn detects within 1 minute whether the main part of the plugin is working, and if it doesn't it runs the command set in config.
Note:
You will need to edit your launch.bat to the following:
:start java -Xmx1024M -Xms1024M -jar craftbukkit.jar goto start
Where 1024M is the amount of memory you use.
For BukkitGUI users
For MultiCraft users
Ask your hosting company for your server to restart as soon as it stops.
Example
Example crash
Note: Example was done with a 3 minute detection, I lowered it to 1 minute.
Config
Commands
/cr : Tells the sender if the plugin is running.
Compatability
V2.0 is compatible with all minecraft versions(tested back to 1.2.5).
Metrics
Crash Restarter V2.0 uses Hidendra's plugin metrics system.
Metrics record and sends:
- The server's Java version
- The OS version/name and architecture
- Whether the server is in offline or online mode
- The amount of CPU cores
- Server Location
- Game Version
- Server Software
If you wish to disable Metrics, you can do so by opt-ing out, which you can do in the Metrics config file under /plugins/PluginMetrics/
To Do
Tell me, and ill see what i can do.
Check out my other plugins for great features!
@fireball1725
Tested this with a quarry, and the blockbreakevent is triggered by the quarry. Also do you think this would be needed for a 1.6.4 server?, as some of the coding may be different, but i would be willing to update it to 1.6.4 if anyone wanted.
Version 1.2 waiting for approval, it fixes a bug i found by looking at the coding(where when the server was empty it would always reset itself to 20 minutes), and also adds onblockbreak and onblockplace timer reset's, with config to configure whatever one's you want.
Thanks, Dablakbandit
@Dablakbandit
Hey, To answer your question about am I running it on any servers, the answer to that is no. It has been some time since I have had a 1.2.5 server running.
As a former Tekkit server owner using 1.2.5 I do know of the issue that you made this for and think it is a great idea. That is why I have been following it, that and I do know people that use the old Tekkit still.
I tried your plugin on a test server just to test it out, all my servers are now running 1.6.4, so I didnt test it on any of those. Also, your idea for a configuration file would be perfect.
Anyway, thanks FireBall
@fireball1725
Are you running it on any server?, as i want to know if it is compatible with all servers. I could make a config options and servers choose what they want to reset the timer on?
And as for the mods, i could turn debugging on and leave a quarry running to test that :) Thanks for the suggestions! Dablakbandit
Looks good, I dont run an 1.2.5 tekkit server anymore so was unable to test it on there, but I would suggest hooking into the BlockBreakEvent and BlockPlaceEvent and reset the timer on that too. This way if a user is online by themselves they wont have to say something to prevent the restart.
Something along these lines...
I don't know how mod's interact, so you might need to check if it was a player that did it or not, just because a quarry might also trigger blockbreakevents.
Thanks, FireBall
Test it for yourselves when it gets approved ;)
@Louis1234567890987654321
Dablakbandit is right, I can tell you have never operated a tekkit server because that's what this plugin is designed for and it is well know that tekkit is plagued by random 'crashes' where the server remains running (It remains running and can have commands run via plugins and console) but does not accept connections from a client. In that case this plugin works wonders for tekkit servers!
@Louis1234567890987654321
Sorry, just seeing as anyone can actually see the page, was just wondering
@Dablakbandit
you are not allowed to post links of unapproved files. you should delete the post.
@Louis1234567890987654321
Ive tried this where i ran my whole server out of memory, and a few minutes later it ran the command stop and restarted, and as for the code they can just do /stop wait for it save etc then click the close button
problems and suggestions by me:
1) if the server crashed, all of the plugins most likely wont work (likely)
2) the code:
users cant stop the server because of this ^
anyway, a nice idea for a plugin! :)
@Dablakbandit
True true, maybe if you made this especially for tekkit make it clear they have to use a world anchor plugin or block to keep it from unloading or (I believe) the chunk with a server spawn does not unload but I'm not 100% sure
Uploaded the release file, hopefully it will be approved soon!
@Catch2223
This may bug out if the chunk is unloaded? Just a thought.
Thanks, Dablakbandit
Thanks for the idea's!
I just had a cool idea, seems how this is meant for tekkit why not use that to your advantage? Maybe instead of checking the chat you could use block break events. If you did this server owners could make a small tekkit machine that breaks a block over and over and if the plugin does not see that the block is being broken anymore then restart the server. This would also give you the ability to have a faster timer and less down time due to crashed :)
Great Idea! Super useful for tekkit because of its notorious crashing 24/7... Another idea for when players are offline and the server is constantly restarting would be to check the number of players then if it is equal to 0 maybe instead of a 10 minute timer make a second timer that is for when there are no players then server owners can make that timer longer if they feel the need. Overall great plugin!
Interesting idea, One suggestion, when no one is on, to prevent the server from restarting every 10 minutes why not just check how many users are online?