Execute Command SSH

Post Reply
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Execute Command SSH

Post 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.
freddyp
Advanced member
Posts: 1008
Joined: Thu Feb 09, 2012 3:53 pm

Re: Execute Command SSH

Post 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!
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Execute Command SSH

Post by jan_suhr »

And to create a shell script on the fly with variables you can use the app Execute Command Friend.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post 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.
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post 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
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post 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.
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post by matthew.hearne »

Have sorted this now by specifying the absolute path to the generated script file and it's worked now.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Execute Command SSH

Post by jan_suhr »

Yes that's the way to do it.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
matthew.hearne
Member
Posts: 24
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post 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!
Post Reply