Run SSH commands

Discussion in 'BungeeCord Plugin Development' started by ImFir3PvP, Jul 12, 2018.

  1. Hey,

    I really struggle how to execute ssh commands in BungeeCord.
    I want to code a CloudSystem and need to start the server.
    Jsch doesn´t worked or what shoud I do, to use Jsch.

    Thanks in advance.
  2. Try Runtime.getRuntime().exec()
  3. MiniDigger


    take a look at the java process api

    oh wait, you actually want to ssh into a remote server? that sounds wrong. Instead I would recommend that every host has a daemon running which are all connected to a master which then can issue commands to the daemons, like "start a server instance of this type with this map".
    • Agree Agree x 1
  4. Here is my method, that I tried to use, but it failed:

    String[] cmd = {"cd /home/SOLO-KnockOut/", "./"};
    runtimexec(p, cmd);

    private static void runtimexec(ProxiedPlayer p, String script) {
    try {
    Process proc = Runtime.getRuntime().exec(script);
    BufferedReader stdInput = new BufferedReader(
    new InputStreamReader(proc.getInputStream()));

    BufferedReader stdError = new BufferedReader(
    new InputStreamReader(proc.getErrorStream()));

    String s = null;
    while ((s = stdInput.readLine()) != null) {

    while ((s = stdError.readLine()) != null)
    } catch (Exception e) {