[ADMN] AutoStop v0.53 - Auto Stop & Restart Your Server [650-803]

Discussion in 'Inactive/Unsupported Plugins' started by jasonznack, May 14, 2011.

  1. Offline

    Phaedrus

    Server AutoStop
    Time-Based Scheduled Server Shutdowns and Restarts

    (Maintenance Release Edition)

    NOTE: May not be working properly in CraftBukkit RB 928 with Permissions 3.


    Credit: AutoStop is a plugin originally written by @dv90 and last updated by @Afforess.
    ALL CREDIT GOES TO THEM. I have done nothing, other than make the plugin visible again.

    The Following Is Modified From the Original Thread:

    I. Requirements: Permissions 2.7+ (Optional)

    II. Description: A simple plugin that saves player and chunk data then shuts the server down at a specified time. Great for clearing memory leaks and updating plugins automatically.

    III. Features:
    • Works with Windows AND Linux AND Mac
    • Saves Player Data and Chunk Data before stopping the server
    • Gives a custom warning at specified time before shutting down
    • Quickly shuts server down
    • Uses autostop.properties to specify what time (24-hour clock) it should shutdown
    • Automatically creates the properties file if it doesn't exist
    • Automatically restarts server (if you enable it)
    • Multiple restart times possible
    IV. Installation:

    1. Download the AutoStop.jar listed below and put it in your plugins folder.
    2. Start and Stop the server once to create the Server AutoStop folder and config file.
    3. Edit the config file to suit your needs. See the example below.
    V. Special Notes:

    • The plugin will automatically put AutoRestart.jar in your bukkit directory.
      • Don't run it; it won't do anything.
      • Do not delete or move it.
    • If your server doesn't auto restart, post your restart_log.txt here.
      • If there is no restart_log.txt, you're doing it wrong.
    • If you use a .bat file (server_nogui.bat), set your path to: path=start server_nogui.bat
    • ANYBODY USING AN EXTERNAL SERVER (Such as a VPS):
      • Remember, your server's timezone may be different. Take that into account when setting up your autostop.properties.
    VI. Commands:

    • /reboot - Immediately saves data and restarts the server.
    • /restart - Same as reboot.
    VII. Permissions:

    • Node: autostop.use
    • Don't use the Permissions Plugin? Just OP yourself.
    IIX. Properties File Example:

    Note: It appears there are duplicate properties files created. One in /plugins/AutoStop/and another in /plugins/ServerAutoStop/. Be sure to set your parameters in BOTH FILES.

    Code:
    stoptime=12:00:00 12:05:00 12:10:00
    # Use 24-hour time. Separate times with a space. [Hour:Minute:Second]
    warntime=0:10 0:30 1:00 5:00 15:00
    # Displays warning this many min:sec before shutting down. Separate with space. [Minutes:Seconds]
    warnmsg=Shutting down...
    # Warning message to display.
    enablerestart=true
    # Enables automatic server restarts. If this is true, path must not be blank.
    path=java -jar craftbukkit.jar
    # Path to server file (including any arguments). This can also be a command if you are using crontab/screen/etc.
    # Linux screen example:
    # path=screen -dmS MinecraftServer java -jar craftbukkit.jar
    
    IX. Current Release:
    X. Trouble Shooting:
    • Please read this thread before posting. Several tips have been posted that might solve your problem.
    • Also see the old thread first before posting your issues. It's a short thread, so no excuses for not reading first.
    • Original Thread: http://forums.bukkit.org/threads/7425/
    XI. Known Issues:
    • It appears there are duplicate properties files created. One in /plugins/AutoStop/ and another in /plugins/ServerAutoStop/. Be sure to set your parameters in BOTH FILES.
    XII. Change Log:
    • Version 0.53
      • Fixed a few small bugs
      • Kicks all players before shutting down
      • Updated to latest RB
    • Version 0.52
      • Supports multiple warn times now
      • Other small fixes
    Older Change Log (open)


    Version 0.51
    • Fixed a small problem with the syntax of the auto-generated autostop.properties file.
    Version 0.5

    • Multiple stop/restart times
    • Added better support for Windows cmd users
    Version 0.4

    • /reboot and /restart commands
    • Permissions support for commands
    Version 0.3

    • Automatic server restarts
    • Stop/Warn time precision works with seconds now
    Version 0.2

    • Added configurable warning message and warning time
    • Attempted automatic restarts but had no luck; possible in a future release
    Version 0.1

    • Initial Release



    Credit: AutoStop is a plugin originally written by @dv90 and last updated by @Afforess.
    ALL CREDIT GOES TO THEM. I have done nothing, other than make the plugin visible again.
     
  2. Offline

    iloveportalz0r

    I was looking for something like this. I remember a server called "New Canada" in Minecraft Alpha 1.2.6 had something like it. I've never seen another server with an auto restarter though.
     
  3. Offline

    Phaedrus

    Mine uses it! :p
     
  4. Offline

    Plague

    please show two latest version without a spoiler
     
  5. Offline

    Phaedrus

    Done.
     
  6. Offline

    vejbuch

    run on 740?
     
  7. Offline

    Phaedrus

    You bet!

    Edited the thread title to reflect version range. Should work fine on any build between 600ish and current
     
  8. Offline

    vejbuch

    Thanks :)
     
  9. Offline

    Zalastri

    How does this work? It's not a wrapper? I'm looking for a way to do this that isn't cron jobs or a separate jar that I have to change my launch options to use.
     
  10. Offline

    Phaedrus

    No, it is not a wrapper exactly, though it does use a separate Jar to restart the server if you've enabled that, but you don't have to change your launch options to use it, in fact you can point it at your existing .bat or .sh file and it will use that to re-launch the server again.

    The plugin stops the server at a specified time (you can specify multiple times if you wish) and if you choose, it can restart the server again. There are many ways you can restart the server though, you don't have to use the built in functionality. For instance you could use the Remote Toolkit plugin (which is a wrapper), or a scheduled task/cron job, or whatever you want.
     
  11. Offline

    xxepiczz

    Really good plugin, recommended to anyone who has a lot of new plugins to add with no real downtime or just to restart
    [diamond][diamond][diamond][diamond]
    [4/5]
     
  12. Offline

    deffol21

    nice plugin
    [air]
    [air][air]
    [air][air][air]
     
  13. Offline

    sillyrosster

    Does it support Linux?
     
  14. Offline

    Phaedrus

    Yes.

    The automatic stop functionality is provided in a bukkit plugin, and the automatic restart functionality is supplied by a Auto-Restart.jar file that gets called by the plugin. The Auto-Restarter.jar simply runs your startup bat or sh file.

    I'll update the main post to make that more clear.
     
  15. Offline

    sillyrosster

    So I have a 'run' file that I open a screen in. Do I just put run.bat in the config? Also what I mean is does the restart functionality work. I have not found a plugin that works with linux correctly.
     
  16. Offline

    Phaedrus

    If you start your server with run.bat, put run.bat into the config file. You can also specify the entire launch argument if you want, like java -xmx1024m -jar craftbukkit.jar

    I do not use linux, but I believe it does indeed work. Perhaps check out the previous thread if you are still having questions: http://forums.bukkit.org/threads/7425/
     
  17. Offline

    sillyrosster

    I'm still confused and I haven't found much on the original post. Do I put it like this: path=run.bat or do I need something else? The command I use to launch my server in the screen is ./run if that helps at all.
     
  18. Offline

    Phaedrus

    Is there a file you use to run your server? Most likely located in the same directory as craftbukkit.jar. Perhaps run.sh?
     
  19. Offline

    sillyrosster

    Yes it is a file.

    I tried just the run.sh and that didn't work.

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

    Phaedrus

    can you post the contents of run.sh?

    Try this: path=sh run.sh

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

    sillyrosster

    Yes this is what is inside the run file.


    Code:
    #!/bin/bash
    screen java -Xmx2048M -Xms2048M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
    
    I now get this error.
    Code:
    16:17:34 [SEVERE] For input string: "30 1" loading ServerAutoStop v1.0.0 (Is it up to date?)
    java.lang.NumberFormatException: For input string: "30 1"
            at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
            at java.lang.Integer.parseInt(Integer.java:481)
            at java.lang.Integer.parseInt(Integer.java:514)
            at net.hailxenu.serverautostop.AutoStopLoop.<init>(AutoStopPlugin.java:206)
            at net.hailxenu.serverautostop.AutoStopPlugin.onEnable(AutoStopPlugin.java:139)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:127)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:676)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:249)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:131)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:109)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:218)
            at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:205)
            at net.minecraft.server.MinecraftServer.init(MinecraftServer.java:145)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:260)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:394)
    
    EDIT: I reinstalled and the error went away.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  22. Offline

    Phaedrus

    Did path=sh run.sh work?

    If not, try this: path=screen -dmS mcserver java -Xmx2048M -Xms2048M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
     
  23. Offline

    sillyrosster

    The path=sh run.sh did not work and neither did path=screen -dmS mcserver java -Xmx2048M -Xms2048M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui. I just start up the server and then type 'restart' in the console.

    It says that you can use a command, but I tried putting ./run in and it didn't do anything different.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  24. Offline

    Phaedrus

    Try changing your run.sh to look like this

    Code:
     #!/bin/bash
     while true; do
       java -Xmx2048M -Xms2048M -jar craftbukkit-0.0.1-SNAPSHOT.jar nogui
       sleep 30
     done
     
    And then in the properties file change enablerestart=false

    That should force it so that whenever the server stops, your sh file will wait 30 seconds and start it again. You won't even be using the autorestart.jar

    Let me know if it works.
     
  25. Offline

    sillyrosster

    I need it to open into a screen. The restart did work though.

    It won't stop.. I do 'stop' in the console and it restarts.

    I think I got it to work right, but it'll restart no matter if I do 'stop' or 'restart'. I can just stop it and then do CTRL-C and it'll quiet. Thanks for the help! If you have a fix for why it doesn't stop when I do 'stop', that would help.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 16, 2016
  26. Offline

    Phaedrus

    It won't stop because we've changed the bash script to tell it to loop forever. So technically it's working as intended.


    Doing CTRL-C to stop it manually is how you'll have to do it. It's kind of a work around for not being able to get the autorestart.jar to accept your path setting.

    I'll try and come up with more things to add to the troubleshooting/faq of the main post

    Glad it works now though.
     
  27. Offline

    Trololol

    Hey!
    I've got some problems.. I'm running a VPS server 24/7, and it gets quite laggy if i don't turn the server on and off after a while.. It may sound wierd, but the Bukkit server won't turn on if i run the Bat file. But for some reason, it works if i run the Snapshot java file..

    Anywho; When i tried to reboot/Restart the server manually as a OP on my server, it would'nt turn back on..
    So i logged onto the VPS to see if anything was wrong.. And then i saw that cmd had opened, and it said it could acces the server. Obviously it tried to acces the server using the bat file.. May this mean that i can't use this plugin because my Bukkit jar isnt behaving right? Or is this fixable?

    It's not tempting to manually shut the server off and on every second hour, so pleeaase reply..
     
  28. Offline

    Phaedrus

    I'm not sure I really follow. How do you currently start the server? Please post the command line you use, or the contents of the bat file, or whatever it is you use.

    What OS are you using?

    Also, post the contents of the plugins properties file.
     
  29. Offline

    Trololol


    I currently start the server by clicking the Bukkit snapshot jar. Nothing comes up, it was just luck that i found it out.. I accedentaly clicked the snapshot jar after i gave up the RUN.bat, and the server started working.
    Only way to stop the server is to stop it in-game by using /stop.
    Don't really know what you mean with Command line, and i can't possibly know the content of the bat file because i cant run it.

    The VPS is running on Windows 2003

    This is the conent of Autostop.Properties:
    Code:
     stoptime=12:00:00
    # Use 24-hour time. Separate times with a space. [Hour:Minute:Second]
    warntime=0:30
    # How many seconds before shutdown/restart to show warning. Separate times with a space.[Seconds]
    warnmsg=Shutting down server...
    # Warning message to display.
    enablerestart=false
    # Enables automatic server restarts. If this is true, path must not be blank.
    path=java -jar craftbukkit.jar
    # Path to server file (including any arguments). This can also be a command if you are using crontab/screen/etc.
     
    I could send you a pic of what pops up in the VPS, but i dunno how..
     
  30. Offline

    Phaedrus

    Hmm, you've got some deeper issues. we're going to need to figure out why you can't run the bat file. Double clicking the bukkit.jar file isn't a good way to run the server.

    First, try setting enablerestart=true in the properties file and making path=start java -jar craftbukkit.jar and testing it. Ya never know.

    Then to figure out what your command line is to launch the server with the bat file, right click the bat file and select edit. This should open it in notepad so you can see what's in it. Post the contents here.

    It would also help if you could answer the following questions:

    Are you running 64-bit windows and java?
    What happens if you type java -version into a command prompt?
    What are the specs of the server? ram? cpu?

    this will help us setup your command line properly

    To send a screen shot you can probably do a CTRL-PrintScreen of your remote window and paste it into MSPaint on your PC, Save the jpeg and get it online somehow.
     

Share This Page