Execute Command SSH

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

Execute Command SSH

Post by matthew.hearne » Tue Oct 13, 2020 3:48 pm

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: 543
Joined: Thu Feb 09, 2012 3:53 pm

Re: Execute Command SSH

Post by freddyp » Tue Oct 13, 2020 6:07 pm

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: 379
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Execute Command SSH

Post by jan_suhr » Tue Oct 13, 2020 6:14 pm

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
Newbie
Posts: 8
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post by matthew.hearne » Tue Oct 13, 2020 6:17 pm

Hi. Thanks for the replies. Will have a look into this in the next few days.

Appreciate the help with this one.

matthew.hearne
Newbie
Posts: 8
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post by matthew.hearne » Tue Nov 24, 2020 5:52 pm

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
Newbie
Posts: 8
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post by matthew.hearne » Tue Nov 24, 2020 6:26 pm

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
Newbie
Posts: 8
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post by matthew.hearne » Tue Nov 24, 2020 6:45 pm

Have sorted this now by specifying the absolute path to the generated script file and it's worked now.

jan_suhr
Advanced member
Posts: 379
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Execute Command SSH

Post by jan_suhr » Tue Nov 24, 2020 7:01 pm

Yes that's the way to do it.
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps

matthew.hearne
Newbie
Posts: 8
Joined: Thu Dec 19, 2019 3:00 pm

Re: Execute Command SSH

Post by matthew.hearne » Tue Nov 24, 2020 7:06 pm

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