Run ssh with Snaplogic script snap

if our Snaplogic groudplex is running on a unix machine, can i write a script with script snap to run a ssh command in my pipeline?


Were you able to find a solution for this? I was hoping to call ssh from a pipeline, possibly using something like (which Snap Logic seems to use for SFTP) or similar package.

yes, we figured it out.

We used script snap with Python. Just few line of code. Simple enough

can you share your code ? thank you a lot

from com.snaplogic.scripting.language import ScriptHook
from com.snaplogic.scripting.language.ScriptHook import *
from subprocess import Popen, PIPE
import subprocess as subprocess

class TransformScript(ScriptHook):
def init(self, input, output, error, log):
self.input = input
self.output = output
self.error = error
self.log = log

def execute(self):"Executing Transform script")
    proc = Popen(["ssh", "", " pwd "], shell=False, stdout=PIPE, stderr=PIPE)
    proc1 = Popen(["ssh", "", " 7za  x /dsdata/application/ORSUBDEV/CornerstoneLms/SourceFiles/ "], shell=False, stdout=PIPE, stderr=PIPE)
    out, err = proc.communicate()
    exitcode = proc.returncode
    self.output.write(out)"Finished executing the Transform script")

hook = TransformScript(input, output, error, log)

Thank you very much!

I will digest this, might follow up with you again.



or unix execute snap can be used.

UNIX Execute Snap!? Is that something custom you have? I don’t see such a thing.

1 Like

it must me a custom snap, you can ask your account manager to get it