Answer the question
In order to leave comments, you need to log in
How to connect via SSH in Java and execute 2 commands in a row?
Good afternoon. I am writing a script to connect via ssh to the machine. The tasks are as follows:
1) Connect
2) Execute the transition to the directory and then run the script with the parameters
3) Close the connection
So. Used jsch library. There were exec and shell examples. Exec is not suitable because it executes 1 command, and Shell could do, but these commands must be entered from the keyboard. And I need these commands to be executed by the script. Can you advise how to solve this problem?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question