series of commands using commons-exec

571 views Asked by At

I am new to apache commons-exec.

Is there a way I can send a series of commands to a remote machine without authenticating each time?

would like to do this order:

ssh a@b
command1
command2

but apparently commons-exec needs this:

ssh a@b \n command1
ssh a@b \n command2

any idea?

1

There are 1 answers

0
Salman A. Kagzi On BEST ANSWER

Try

ssh a@b "command1; command2"

this is a common way to execute multiple command on a remote system via ssh from within a script. This should work for your case as well.