Framework (Java) for Opening Remote Sessions for Execution of Commands on Unix-based Server

2

I needed a framework to be able to open remote sessions on (Unix-based) servers and execute commands remotely (if possible as% with% same).

Does anyone know of any and mature that can serve this purpose?

Main purpose:

What happens is that I have a web application running on a server and I need to collect data on other servers. This data is preprocessed in% w / w% w / w% and saves the results to a file.

There are more than 10 servers, and it would be great / ideal that running this root on each of the servers be done from the application instead of running it per machine and then from the application read the result. The idea is to open a session for each of the machines and run the pre-processing and then read the results.

What I have:

At the moment I use shell script and it has given me a serious problem, I can not execute existing scripts on the servers whose operations involve writing (creating new files) on the system.

Note: My main problem at the moment is that running script does not run successfully, but when I go directly to the machine it runs perfectly.

As for permissions I have also analyzed and to remove doubts permissions is everything for everyone (777).

I think (hopefully it is not the result of my despair) that the problem is with jsch and would like to move and move to another where someone already has some experience.

    
asked by anonymous 07.10.2014 / 17:16

1 answer

1

I've already used jsch to build build and deploy remote. Unfortunately I do not have the source code because it was in a company where I no longer work.

What I can say is that it works, but it's very complicated. It was a good part of trial and error, some settings related to encoding , including modifications to the project source itself.

I do not recommend this kind of solution.

If you were going to implement something like this today, probably:

  • It would make a simple application with a Web Service Rest that listens on a certain port, executes the necessary commands and returns the information.
  • Would use another language with more modern libraries, like Ruby or Pyhton.
  • If you really need to be an SSH client, you would probably use Python, as there seems to be multiple protocol implementations for this language .

    As it was mentioned that the information would be read by an application, it is important to consider issues of timeout and parallelization. The application may use different threads to perform a web service (or SSH) request.

    There should be a central control not to make the user wait to "always stop" in case of failure and also to ensure that blocked connections are not accumulated due to some communication failure (especially in the case of SSH).

        
    07.10.2014 / 17:47