Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

Running multiple SSH commands in single SSH Session

$
0
0

I have the need to run multiple SSH commands from a single session. The reason for this is that I'm logging into a Cisco device and need to be in the 'configure terminal' context before executing the second command. I cannot have the SSH session run the first command, disconnect, then reconnect to run the second.

 

I don't believe this is possible with the default 'Run SSH Command' workflow, so I've tried to build my own.

 

When I use two lines such as:

 

session.executeCommand("conf t",true) ;

session.executeCommand("do sh run int vlan " + vlan_id,true) ;

 

I get the following error:


Unable to execute command InternalError: session is down (Workflow:Cisco-CreateVLAN / Create_VLAN_On_Switch (item2)#20) (Workflow:Cisco-CreateVLAN / Create_VLAN_On_Switch (item2)#33)

 

The executeCommand method specifies the following:

 

Execute a single command and wait until completed, return the stdout result if synchronous. This command will connect the session, request an execution channel, execute the command and close the execution channel.

 

From the above, it appears that trying to execute multiple commands via SSH is not possible. Is anyone able to offer any insight into this?

 

Thanks


Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>