Application RemoteToolkit - Restarts + crash detection + auto saves + remote console!

Discussion in 'Bukkit Tools' started by drdanick, Jan 15, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    drdanick

    Minecraft RemoteToolkit
    -Less downtime, more fun for your players, more power to you!

    Are you a Minecraft server administrator? Do you value up-time and stability? Do you fancy the ability to remotely control your server, both in-game and out of game, in a myriad of useful ways from a plethora of different devices?
    If you answered yes to any of the above, then the Minecraft RemoteToolkit is for you!


    What the Minecraft RemoteToolkit Plugin and Wrapper do for you:
    • Provides almost perfect server uptime with no need for action from an owner/administrator!
    • Have your server save and restart at any time period with configurable restart warnings!
    • The Toolkit guarantees a restart within the set restart period, even if your server crashes, becomes unresponsive, or encounters a "SEVERE" exception!
    • Remotely control every function of the Toolkit, even from your smart phone!
    • Full remote console access via telnet with support for multiple terminal types!
    • Telnet daemon conforms to current Telnet related RFCs!
    • Customizable alert messages!
    • Fully extendable though 3rd party modules!
    • Full feature set works with most craftbukkit builds!
    • Most features work with any Minecraft server variation, even vanilla!
    • Telnet can be disabled!
    For server administrators
    Download - Release 10, Alpha 15.3 [CB 1.7.2-R0.2] (wget friendly)
    Instructions & Documentation

    For developers
    UDP API REV 8 | Documentation
    Module API | Coming soon!

    For everyone
    Official IRC channel
    #remotetoolkit @ irc.esper.net


    "Help! I've downloaded it, but I do not know how to get it working!"
    Stop! Before you give up or ask for help, make sure you have read the step-by-step installation instructions on the wiki page. If you are still having problems, please do not be hesitant to post a request for help on this thread or in the IRC channel - no matter how simple your problem seems.


    Todo


    [​IMG][​IMG]
    Any donation would be very much appreciated. I'm but a poor University student, and I sacrifice quite a lot of unpaid time to keep the Toolkit updates and support flowing.

    Thank you to the following who have chosen to support the Toolkit through a donation:
    Deren909, marshall007, Vittek, clanslots, meee, KyneSilverhide, szoller, hungoverfurball, Lama_0, Viet, acc1dent, joby890, Liger_XT5
     
    Last edited: May 6, 2017
  2. Offline

    LaxWasHere

    Ah yes, he made me a module but it doesn't seem to work. Here is his source since I can't find the DL link.
    Code:
    package commandmodule;
     
    import com.drdanick.McRKit.ToolkitEvent;
    import com.drdanick.McRKit.module.Module;
    import com.drdanick.McRKit.module.ModuleLoader;
    import com.drdanick.McRKit.module.ModuleMetadata;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.PrintStream;
     
    public class CommandModule extends Module
    {
      private ModuleMetadata meta;
      private ModuleLoader moduleLoader;
      private ClassLoader cLoader;
     
      public CommandModule(ModuleMetadata meta, ModuleLoader moduleLoader, ClassLoader cLoader)
      {
        super(meta, moduleLoader, cLoader, ToolkitEvent.ON_SERVER_HOLD, ToolkitEvent.ON_SERVER_RESTART);
      }
     
      protected void onEnable() {
      }
     
      protected void onDisable() {
        try {
          Process p = Runtime.getRuntime().exec("cd /root/mc/sg1; unzip complete.zip");
          BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
          BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream()));
          String s;
          while ((s = stdInput.readLine()) != null) {
            System.out.println(s);
          }
          while ((s = stdError.readLine()) != null)
            System.out.println(s);
        }
        catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
     
  3. Offline

    drdanick

    There are a number of things wrong here - i'll give both a short and thorough explanation.
    half_bit will probably want to have a look at this.

    Short version:

    Firstly, cd and the delimiter ';' cannot be used with exec(). Instead, you should use this overloaded exec call to specify the working directory of the child process: Runtime.exec(String command, String[] envp, File workingdir)

    Secondly, the stdInput and stdError readers should be read from simultaneously in their own threads. You can use Process.waitFor() to block until the child process completes.


    Thorough version:

    Firstly, exec is used to fork the current process and execute some child process from the program specified by the argument. It is not used to execute shell commands.
    The current directory stack is always maintained by a shell, and as such commands that manipulate it such as cd are not real programs and cannot be called through exec(). Similarly, ';' is a delimiter which is used by a shell to separate two distinct commands, and cannot be used in exec() for the same reason.
    Java provides an overloaded exec method which allows you to specify the working directory used when executing a program. It's signature is: exec(String command, String[] envp, File workingdir)

    The next problem is that the standard output and error streams are being read one ofter the other. This may not be an issue at first, but if the error stream reader fills up before the process exits, the system dependent buffers associated with the stderr stream of the child process will fill. This will quickly cause the child process to go into deadlock.
    There are two solutions to this. The ideal solution is to read from both standard streams simultaneously in two separate threads. The second solution, which may be considered bad practice, is to give the stdError reader a generous initial buffer size which is not likely to be filled before the program terminates.
     
  4. Offline

    breezeyboy

    It adds a commands /kickall and /kick but it seems to be doing /kickall without argments because the default kickall message is appering so ermm unless you code it into your plugin to not issue the kickall cmd/kick cmd but use onlineplayers.kickplayer(configoption);

    Like

    onrestartcode

    for(Player onlineplayers : Bukkit.getOnlinePlayers()){

    onlineplayers.kickPlayer(yourconfigoptionforkickeveryonewhenitreboots);

    }
     
  5. Offline

    drdanick

    The wrapper invokes the "kickall" event by sending /kickall through the console as a command (which is implemented by the toolkit plugin). On the plugin side I do make use of the Player.kickPlayer() call.
    Fortunately, R11 does not operate like this and will not conflict with your plugin.
     
  6. Offline

    Viet

    Is there any recommended startup script that you guys recommend besides extra-runtime-arguments?
     
  7. Offline

    brandcool86

    Hey,
    When can we expect a update? Beta or rb build ?
     
  8. Offline

    Tsaukpaetra

    Not for me, I literally have this as my startup script (Win32):
    java -Xmx7M -Xms3M -XX:MaxPermSize=7M -jar Minecraft_RKit.jar
     
  9. Offline

    Sanpletext

    Hi!
    I'm using this awesome plugin on my small server, but I wonder is there way to change wrapper to STOP instead of RESTART after failed heart beats limit is reached. I'm using simple "While true .. do .. done" loop (with some fancy bash commands like for back upping and logging etc.), and wrapper restart doesn't end java command, so logging etc. doesn't happen after crash.
     
  10. Offline

    Tsaukpaetra

    I suppose this could be supported, perhaps with a future option:
    failed-heartbeat-stop-count=5 (Which doesn't exist yet)
    But why would you want to stop the wrapper?
    If this doesn't quite come through, I suppose you could always make an addon that could override the even for heartbeat failure and supplant your own code...
     
    RealIncorrect likes this.
  11. Offline

    RealIncorrect

    hello everyone! please, help me - how to fix:

    OS - Linux Debain
    craftbukkit: 1.3.2 R2.0
    This error occurs when I change login and password in rtoolkit.sh.
     
  12. Offline

    Tsaukpaetra

    It sounds like you may be using symbols in the username or password. Try setting just numbers and letters (or properly escaping the symbols) and post back again. Remember: You can always add users afterwards and they won't have this limitation, it's just the linux commandline. This also happens in Windows ;)
     
  13. Offline

    RealIncorrect

    I didn't use symbols in the username and password.
    On Windows (with such parameters of setup) this error didn't occurs.
    (cd "$DIRECTORY"; java -Xmx30M -Xms30M -XX:MaxPermSize=40M -jar Minecraft_RKit.jar ${realincorrect}:${secret})
     
  14. Offline

    Tsaukpaetra

    Oh I see the issue. The username and password are two arguments, not one argument delimited by a colon. Replace the colon with a space and see if that helps.
     
  15. Offline

    RealIncorrect

    When I try to start the server with the space instead of a colon in the console gives this: USAGE: Minecraft_RKit [OPTIONS] [USERNAME: PASSWORD].
    rtoolkit.sh:
     
  16. Offline

    Tsaukpaetra

    I apologize, my first statement is apparently incorrect about the colon.
    What happens when you execute it directly, i.e.:
    java -Xmx30M -Xms30M -XX:MaxPermSize=40M -jar Minecraft_RKit.jar user:pass
    Then only reason why it has variables $user and $pass is so that you don't need to change the actual command line below it.
    Your current .sh file should look like so:
    Code:
    #!/bin/bash
     
    USER=Realincorrect
    PASS=secret
     
    ##YOU SHOULD NOT NEED TO EDIT ANYTHING BELOW THIS LINE##
    DIRECTORY=$(cd "`dirname "$0"`" && pwd)
    (cd "$DIRECTORY"; java -Xmx30M -Xms30M -XX:MaxPermSize=40M -jar Minecraft_RKit.jar ${USER}:${PASS})
     
  17. Offline

    hotelmariofan

  18. Offline

    Tsaukpaetra

    Wait, do you meant people playing minecraft cannot join, or they cannot Telnet into the server? Is your "white-list=false" in the server.properties file? Are there any other files?
    I don't have any knowledge on running Tekkit, but make sure in the wrapper's "minecraft-server-jar=" you have it named correctly if it isn't craftbukkit.jar.
     
  19. Offline

    hotelmariofan

    Yes, I mean people playing minecraft cannot join. I am the only one with the ability to telnet into the server. My whitelist settings is set to false, yes and I did renamed the "minecraft-server-jar=crafbukkit.jar" to the correct file name.
     
  20. Offline

    Tsaukpaetra

    Well, I'm assuming when you say "only myself can join the server" that you're on the local host. Do you have a firewall that's blocking incoming connections or something? Based on the log line that reads: "Unexpected error in shell!" that there is something happening on the console that kills the connection.
    What OS are you running on, java version, command line used to launch the toolkit, do you see any other errors, etc. More information is necessary to adequately diagnose your issue.
     
  21. Offline

    hotelmariofan

    Well, for some reason all my forwarded ports had been erased on my router. I forwarded 25565 and it fixed everything. Thanks for your time and help, sorry about that.
     
  22. Offline

    Tsaukpaetra

    Lol it happens dude ;) What's weird is that minecraft was still kinda recognizing connections (or so it seems?)...
     
  23. Offline

    RealIncorrect

    Thank you! Now everything is working properly.
     
  24. Offline

    Tsaukpaetra

    No problem, One is glad to be of service. ;)
     
  25. Offline

    Sanpletext

    I'd stop it 'cause restarting doesn't stop "java" command in .sh process. And I got some own logging systems and backupping and stuff in that same .sh file after java command. There haven't been any need to even force restart so far though...
     
  26. Offline

    Tsaukpaetra

    Hmm, perhaps a full toolkit shutdown? Change the value of this line to have the toolkit shutdown the server and exit completely in that case:
    toolkit-autoshutdown-delay=0
    This value represents how long the server will be allowed to run before the toolkit will shut it down and terminate itself.
     
  27. Offline

    enterprise12

    Hey i have one problem, So i use Tekkit and i just switched it to Craftbukkit++ and used this plugin,
    I use to get Console Colors and now i dont, I went into the configs and went to "Server-Arguments" and erased the --jline thing but i still dont get Console color?

    Im wondering if its "Extra runtime arguements" please help me, i would really like the console color back.
     
  28. Offline

    Tsaukpaetra

    I haven't been able to successfully re-enable console colors after using the toolkit. Seems like Java itself is filtering out the color codes because it detects that the output stream is being redirected through a pipe (which traditionally doesn't support color codes).
    If you notice, there are also certain oddities that happen as well, such as differences between carriage returns and line feeds (if you're on windows for example).
     
  29. Offline

    Ruan

    I have created a RemoteToolkit module which automatically restarts the server when it has crashed.

    RemoteToolkit currently doesn't have the ability to detect when the server crashes, because the server is fully responsive to commands(and thus heartbeats from RemoteToolkit) after crashing.

    Source: https://github.com/ruan942/CrashAutoRestart

    Download: https://github.com/downloads/ruan942/CrashAutoRestart/CrashAutoRestart.jar

    readme:
     
  30. Offline

    Tsaukpaetra

    Nifty! And the source looks relatively simple to understand. 'course, my server isn't in the habit of crashing, but if it starts this would be a neat little module!
    One thing that you could add is a repeat-offender count, kind of the opposite of the heartbeat, where it would stop attempting to reload the server (and just hold the server instead of restarting it) if it restarts too much in a given time. Perhaps inside the onStderrString function just before the try{} block.
     
  31. Offline

    P_S

    Hi, can u add command ".reloadmodules" or something for load / unload RTK module ?
     
Thread Status:
Not open for further replies.

Share This Page