Page 1 of 1

Execute Command SSH

Posted: Tue Oct 13, 2020 3:48 pm
by matthew.hearne
We'd like to be able to have a flow where we can run a command(s) on a remote machine using SSH.

The machine we want to connect to is accepting SSH connections as we have tested this from the machine running Switch (a Mac using Terminal) to the remote machine (a Windows 10 pc).

We are guessing that we'd be able to use Execute Command to do this, but unsure as to how you would execute multiple commands in sequence i.e. login to the remote machine, run a command, then log off the machine.

Any help or ideas on how to do this would be appreciated.

Re: Execute Command SSH

Posted: Tue Oct 13, 2020 6:07 pm
by freddyp
You should let the property "Command or path" of "Execute command" point to a shell script instead of to ssh itself. Do not forget to chmod +x the shell script!

Re: Execute Command SSH

Posted: Tue Oct 13, 2020 6:14 pm
by jan_suhr
And to create a shell script on the fly with variables you can use the app Execute Command Friend.

Re: Execute Command SSH

Posted: Tue Oct 13, 2020 6:17 pm
by matthew.hearne
Hi. Thanks for the replies. Will have a look into this in the next few days.

Appreciate the help with this one.

Re: Execute Command SSH

Posted: Tue Nov 24, 2020 5:52 pm
by matthew.hearne
An update to this and wondering if someone can assist.

I have managed to create a Shell script on the mac (a .sh file which I then CHMOD in terminal and then run). This executes correctly and runs the external program with arguments that I need it to.

If I copy the contents of the script file and use it in the Execute Command Friend flow element, it doesn't do anything. I get no errors, it just seems to do nothing, so slightly confused as to how to proceed.

Any help is appreciated as banging my head against the wall now!

Matt

Re: Execute Command SSH

Posted: Tue Nov 24, 2020 6:26 pm
by matthew.hearne
I have just realised that Execute Command just outputs a SH file for me to actually execute.

My next question then is .... how do I get the Execute Command element to run this?

Not sure what to put in the "Command or Path" and the "Arguments" sections.

Re: Execute Command SSH

Posted: Tue Nov 24, 2020 6:45 pm
by matthew.hearne
Have sorted this now by specifying the absolute path to the generated script file and it's worked now.

Re: Execute Command SSH

Posted: Tue Nov 24, 2020 7:01 pm
by jan_suhr
Yes that's the way to do it.

Re: Execute Command SSH

Posted: Tue Nov 24, 2020 7:06 pm
by matthew.hearne
jan_suhr wrote: Tue Nov 24, 2020 7:01 pm Yes that's the way to do it.
Got there in the end after much trial and error!