Inactive [ADMN] SimpleRestart v1.1.0 - Simple server [automatic] rebooting and commands [1000]

Discussion in 'Inactive/Unsupported Plugins' started by FuzzyWuzzie, Jul 4, 2011.

  1. Offline

    FuzzyWuzzie

    SimpleRestart v1.1.0

    Download: Jar Only | Full Zip
    Source: GitHub

    SimpleRestart is a plugin which allows server operators to simply and easily reboot their server, as well as schedule automatic reboots of the server "for freshness". The plugin contains flexible yet straightforward commands, is easy to set up and use, and makes use of Permissions. It does this by simply emulating the console typing in the "stop" command then using a slightly modified startup shell script normally used to boot Bukkit servers to boot the server again.

    Installation (open)
    Simply copy SimpleRestart.jar and the SimpleRestart folder into the "plugins" subdirectory of your minecraft server. If you do not copy in the SimpleRestart folder, it will be created for you automatically, along with a default configuration file. Edit the configuration file (config.yml) as you see fit, then modify your server startup script so that it automatically reboots the server when it gets "/stop"ped.

    Configuration (open)
    The default configuration file is mostly straight forward and contains numerous comments, however, each option is detailed below:
    • auto-restart: enable / disable automatic, time-scheduled restarting. If this is set to "no" then the server will only ever restart when using the "/restart" command.
    • auto-restart-interval: this is how often (in hours) the server will automatically restart itself (only if auto-restart is set to "yes")
    • warn-times: Before the server restarts, it will send out a friendly warning to all connected players, this setting is a list that describes the amount of time (in minutes) before the server automatically reboots that players get warning of the reboot. For example:
      warn-times: [10, 5, 2, 1]
      will warn players at 10 minutes, 5 minutes, 2 minutes, and 1 minutes before the server reboots.
    • warning-message: this is the message that will be displayed as a warning that the server will be restarting soon. You may use classic minecraft server colour codes (http://www.minecraftwiki.net/wiki/Classic_server_protocol#Color_Codes) and "%t"% to indicate how long before the server reboots. For example:
      will display "Server will be restarting in 5 minutes!" in red (with warn-time = 5)
    • restart-message: this is the message that players will see when they are kicked from the server due to the automatic reboot. Again, colour codes can be used here.


    Editing Your Startup Script (open)

    In order for this plugin to work properly, you will have to make a slight modification to
    your startup script (Server.bat on windows, minecraft.sh on Linux). This plugin works by
    simply scheduling regular "stops" of the server. Then when the server goes down, the
    startup script simply loops around and starts the server up again, with minimal mumbo-jumbo.

    This is accomplished in the startup scripts using infinite loops:
    • For Windows, put ":start" on the line before what you want repeated, then "goto start" on the line after what you want repeated to make an infinite loop. Example Server.bat:
      Code:
      @ECHO OFF
         SET BINDIR=%~dp0
         CD /D "%BINDIR%"
         :start
         "%ProgramFiles%\Java\jre6\bin\java.exe" -Xincgc -Xmx1G -jar craftbukkit-0.0.1-SNAPSHOT.jar
         goto start
    • For Linux, put "while true" <new line> "do" on the lines before what you want repeated, and "done" on the line after to make an infinite loop. Example minecraft.sh:
      Code:
      #!/bin/sh
         BINDIR="\$(dirname "\$(readlink -fn "\$0")")"
         cd "\$BINDIR"
         while true
         do
            java -Xincgc -Xmx1G -jar craftbukkit-0.0.1-SNAPSHOT.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
         
    • If you are using screen on linux, you may use something like this:
      Code:
      #!/bin/sh
         while true
         do
            screen -t "MinecraftServer" -S "MinecraftServer" bash -c 'java -Xms14000M -Xmx14000M -jar craftbukkit.jar nogui ; exit'
            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
         
    On Windows, to exit this infinite loop (i.e., take the server down for good), simply close the command window. On Linux, press "Ctrl+C" to cancel the process.


    ** Note: example startup scripts can be downloaded from the source repository!

    Permissions Nodes (open)
    To use just about anything in the /restart or /reboot commands, users must have the permission "simplerestart.restart"

    To use the /restart time command, users must have the permission "simplerestart.time"

    To use the /memory command, users must have the permission "simplerestart.memory"

    Commands (open)
    All commands may be typed in the console (without the "/" of course) or by players in-game, and /restart and /reboot are synonyms for each other and can be used interchangeably.
    • /restart help: gives a simple help menu
    • /restart now: restarts the server immediately
    • /restart time: informs you how much time is left before the server restarts
    • /restart (h|m|s) <time>: turns automatic restarting on (if it was off) and reschedules the next automatic restart to be <time> (hours, minutes, or seconds) away from now. For example, to reboot the server in 15 minutes, use

      Where 'h' is for hours, 'm' is for minutes, and 's' is for seconds.
    • /restart on: turns automatic restarting on (if disabled in configuration OR via commands. Will start the scheduler from the current time based on the settings in the configuration.
    • /restart off: cancels any pending automatic restarts and prevents automatic restarts from happening until re-enabled
    • /memory: displays the java runtime memory usage, useful for catching runaway plugins



    Changelog:
    • v1.1.0 - Add multiple warnings and tidied up code a bit
    • v1.0.1 - Added forced auto-save before reboot and separate permissions node for checking how long before restart
    • v1.0.0 - Initial release. Compiled against CraftBukkit 953 and Bukkit 754.
     
  2. Offline

    Plague

    although this is the initial version, you need a changelog (and latest two vrsions cannot be inside a spoiler)
     
  3. Offline

    FuzzyWuzzie

  4. Offline

    sagethor

    @FuzzyWuzzie
    Do the reboots still happen when the server crashes / freezes / goes down? I put this on my server which has been going down, in the hopes that it would start up again when the time is up for the next reboot.

    Unfortunately, this doesn't seem to be the case - my server's still down.
     
  5. Offline

    FuzzyWuzzie

    It should, provided you have modified your startup script correctly. This plugin really just automatically "stops" the server at regular intervals and relies on the startup script to boot the server up again.

    The only reason I can see it ot rebooting is if your server lags so hard that it crashes the actual computer.
     
  6. Offline

    Parrothead

    I like this plugin. This will keep my server from lagging by staying on too long.

    Suggestion: Abort restarts if there are x players or more playing and delay the restart until the condition is met. That way the server only resets when nobody (or a configured amount) is online to prevent major interruptions.
     
    gmc and superchuckinator like this.
  7. Offline

    FuzzyWuzzie

    @Parrothead thanks, I'll look into it - shouldn't be too hard.

    @tips48 thanks!
     
  8. *start shameless self promotion*
    My plugin does everything thats been requested so far
    */start shameless self promotion*
     
  9. Offline

    FuzzyWuzzie

    And yet we could never get your plugin to work properly.. It would send the server down, then not take it back up again. When we finally got it working, it would randomly shut the server down even when it was not supposed to. The whole point of this plugin was so that it was NOT doing wacky things like force-quitting processes, and that it is simple to install, easy to operate, and a simple, straightforward plugin that just works. Our server experienced silly downtime using RestartNow, hence I made this, largely for our own use, but figured I would share it with the rest of the Bukkit community. If anyone wants to continue to use RestartNow, and can make it work to your liking, then by all means do so.
     
  10. Offline

    MonsieurApple

    Approved!
     
  11. Offline

    FuzzyWuzzie

  12. Isn't there a way to give only /restart time for players?
     
  13. Offline

    FuzzyWuzzie

    @ibab updated to do just that!
     
  14. Offline

    Shadowlauch

    I have a Linux VServer and i run the Minecraft Server in a Virtual "screen" console. Can i use this plugin with screen and if i can, How?

    Thanks :p
     
  15. Offline

    FuzzyWuzzie

    I am actually just going through sorting this out with screen right now, as screen can be a bratty child to deal with sometimes :p

    I'll keep you posted, I hope to have a solution by tonight!
     
  16. Offline

    Callum

    Very nice plugin :D
    It works unlike other similar plugins.

    But is there are way so you could have multiple warning times and warning messages?
     
  17. Offline

    arsjet

    I want to increase the number of notification messages.
    (seconds) warn-message = 300,180,60,30,10,5
     
  18. Offline

    Callum

    Yeah I was thinking that but I haven't got around to testing it yet.
     
  19. Offline

    Teldelariel

    Awesome was just thinking the same thing, a 5m 3m 2m 1m warning chat flash. Have just installed the plugin and if it does exactly what you say then thank you :)

    I dont have a minecraft.sh file anywere to be found so how do I edit it to loop a restart ?

    Its alright I figured it out as follows:
    In the putty screen input the following before starting the server up using java -Xms512M -Xmx512M -jar craftbukkit.jar nogui

    so it looks like this
    !/wherever_your_user_directory_is/minecraft/ while true (shift enter)
    do java -Xms???? -Xmx???? -jar craftbukkit.jar (replace ? with your set memory allowance) (shift Enter)
    done (hit enter)
    This worked for me to enable a rolling loopback to the command parameter. Hope this helps others

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

    FuzzyWuzzie

    Ok, updated with v1.1.0 to include multiple reboot warnings. Can be as many reboot warnings as you wish. Update your config files to include the setting:
    Code:
    warn-times: [10, 5, 2, 1]
    (For example). This will warn players at 10 minutes, 5 minutes, 2 minutes, and 1 minute before the server reboots.

    Shadowlauch you can use it with screen, try using this shell script:
    Code:
    #!/bin/bash
    while true
    do
    	screen -t "MinecraftServer" -S "MinecraftServer" bash -c 'java -Xms14000M -Xmx14000M -jar craftbukkit.jar nogui ; exit'
    	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
    Save that as "start.sh", then run it with "sh start.sh". It will start a new screen session, then when the server goes down, exit the screen session, give you 5 seconds to fully stop the server (use Ctrl+C to do so), then reboot the screen session and the server.

    Let me know if you have any problems!
     
  21. Offline

    arsjet

    Thank you very much !!
     
  22. Offline

    Shadowlauch

    The restart command isn't working anymore. Only /memory works.
    But thanks for the "Screen"-Code thsi works fine
     
  23. Offline

    Callum

    Code:
    warn-times: [10, 5, 2, 1]
    Sweet thanks :)
     
  24. Does 0.5 or 0.05 work aswell for the warn times? So I could make it would count from 10 seconds to 0 seconds.

    Also, I noticed when the time goes to 0h0m0s it just starts going like 0h0m-1s and so on, putting negative number there. Why is it doing that?
     
  25. Offline

    FuzzyWuzzie

    @Shadowlauch that's weird, as the /restart commands still work just fine on both testing servers I'm using. What does it say when it does not work? Are you sure you're typing commands in properly? Do you have the permissions nodes set properly? You could maybe try completely removing the .jar and config folder and re-installing it them?

    @ibab yes, decimal numbers (with as many decimals places as a java Double can handle) are acceptable for warning times. Right now its a bit cludgy doing that, and I want to change how its done so that you could do "0h0m10s" for example, but I haven't had the time to do that yet. Also, the numbers should only be going negative if the server doesn't reboot for some reason, and I have no idea why that's not happening here. Can you post more details about the situation when those numbers go negative? Is it when you do /restart time? What commands did you type before that? What are the values in your configuration?
     
    Orakuls likes this.
  26. Heres the config.
    Code:
    ---
    # enable / disable auto-restart
    auto-restart: yes
    
    # in hours (decimal points ok -- ex: 2.5)
    # must be > (warn-time / 60)
    # default is every 8 hours
    auto-restart-interval: 2
    
    # warning times before reboot in minutes (decimal points ok -- ex: 2.5)
    warn-times: [10, 5, 2, 1]
    
    # what to tell players when warning about server reboot
    # CAN use minecraft classic server protocol colour codes
    # use %t to indicate time left to reboot
    warning-message: "&cServer will be restarting in %t minute(s)!"
    
    # what to tell players when server reboots
    # CAN use minecraft classic server protocol colour codes
    restart-message: "&cServer is restarting, we'll be right back!"
    I've been checking the timer and sometimes just notice its at 5 minutes left and it haven't warned in the 10 or 5 minutes, like it should.
    It worked fine while I was using the 1.0.0, but when I updated to 1.1.0 it started doing this. I also installed a plugin called Scheduled Announcer, so could it be that they are not compatible together?

    EDIT: I did /restart now once and after that it seems to be working just fine.
    EDIT2: Nevermind, now its again 9mins left and it didn't give any warnings during the 10 mins. Its odd is sometimes work but sometimes not. =/
     
  27. Offline

    Beldrama

    You think there's a way to restart the server without it doing the 'stop' command? Let's say if the server crashes and get the Read Time out error.

    Would be pretty handy if it could restart itself after a crash without having to wait 8 hours for me to wake up, lol :c
     
    Arton likes this.
  28. Offline

    icychicken5

    I'm not sure if this was stated already, and I just couldn't find it, but can I, or how do I, edit my startup script if I run my server on a Mac.
     
  29. Offline

    zookalicious

    @icychicken5 - Mac servers should be able to use the Linux script.

    Awesome plugin FuzzyWuzzie! I will definitely be using this!
     

Share This Page