imthekrish Respected Contributor.
Respected Contributor.
583 views

weird behavior SSH SHELL Command

Below commands executes successfully sometimes and fails the other times. using SSH SHELL command

expect (.*\s*)*[%#$:>]
send echo $PATH
expect (.*\s*)*[%#$:>]
send echo abc

SSH SHELL Command v2

{exception=com.hp.oo.content.ssh.exceptions.SSHException: Script did not fully finish, had: 3 commands left java.lang.Exception: readTimedout at: 20009ms
Instructions left: 3
at com.hp.oo.content.ssh.services.impl.SSHServiceImpl.runExpectCommand(SSHServiceImpl.java:244)
at com.hp.oo.content.ssh.actions.SSHShell.runSshExpectCommand(SSHShell.java:115)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.hp.oo.sdk.plugins.abstracts.BaseActionPlugin.execute(BaseActionPlugin.java:53)
at sun.reflect.GeneratedMethodAccessor4518.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.hp.oo.maven.PluginAdapterImpl.executePlugin(PluginAdapterImpl.java:328)
at com.hp.oo.maven.PluginAdapterImpl.execute(PluginAdapterImpl.java:248)
at com.hp.oo.execution.control.actions.contentexecution.ContentExecutionActions.executeContentAction(ContentExecutionActions.java:97)
at sun.reflect.GeneratedMethodAccessor849.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.cloudslang.worker.execution.reflection.ReflectionAdapterImpl.executeControlAction(ReflectionAdapterImpl.java:62)
at io.cloudslang.worker.execution.services.ExecutionServiceImpl.executeStep(ExecutionServiceImpl.java:326)
at io.cloudslang.worker.execution.services.ExecutionServiceImpl.execute(ExecutionServiceImpl.java:80)
at io.cloudslang.worker.management.services.SimpleExecutionRunnable.executeRegularStep(SimpleExecutionRunnable.java:167)
at io.cloudslang.worker.management.services.SimpleExecutionRunnable.run(SimpleExecutionRunnable.java:120)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.cloudslang.worker.management.services.WorkerThreadFactory$1.run(WorkerThreadFactory.java:33)
at java.lang.Thread.run(Thread.java:745)

0 Likes
4 Replies
imthekrish Respected Contributor.
Respected Contributor.

Re: weird behavior SSH SHELL Command

This is resolved by reserving send and expect

send echo $PATH
expect (.*\s*)*[%#$:>]
send echo abc

expect (.*\s*)*[%#$:>]

0 Likes
AndreiTruta Outstanding Contributor.
Outstanding Contributor.

Re: weird behavior SSH SHELL Command

Thank you for letting us know

Andrei Vasile Truta
0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: weird behavior SSH SHELL Command

This problem is not solved totally. SSH SHELL is so unpredictable. Is there any standard expect format that will support any kind of expect like $,>, : ,%, basically all types of prompts expected while executing any script.

For example my shell script has a sleep 15 inside and SSH SHELL is exited with return 0 and logoff ..

my script test.sh

echo HI

echo Im here

sleep 10

echo im still here

command :

send /opt/x/test.sh

expect (.*\s*)*[%#$:>]

SSH SHELL has problem with this expect regex

SSH SHELL operation sometimes doesnt like that sleep in between 

What is the permanent solution for this, any documenation on how to use this operation?

 

0 Likes
imthekrish Respected Contributor.
Respected Contributor.

Re: weird behavior SSH SHELL Command

@AndreiTruta @VladM could you guys any solution for this issue

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.