0

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?

reza
  • 139
  • 1
  • 10

1 Answers1

0

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.

Salman A. Kagzi
  • 3,833
  • 13
  • 45
  • 64