02-06-2018 01:49 PM
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?
Thanks
03-01-2018 04:49 PM
Were you able to find a solution for this? I was hoping to call ssh from a pipeline, possibly using something like JSch - Java Secure Channel (which Snap Logic seems to use for SFTP) or similar package.
03-02-2018 08:09 AM
yes, we figured it out.
We used script snap with Python. Just few line of code. Simple enough
03-11-2019 01:15 PM
can you share your code ? thank you a lot
03-28-2019 05:04 PM
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):
self.log.info("Executing Transform script")
proc = Popen(["ssh", "orsubdev@dev-server.com", " pwd "], shell=False, stdout=PIPE, stderr=PIPE)
proc1 = Popen(["ssh", "orsubdev@dev-server.com", " 7za x /dsdata/application/ORSUBDEV/CornerstoneLms/SourceFiles/testCasesSql.zip "], shell=False, stdout=PIPE, stderr=PIPE)
out, err = proc.communicate()
exitcode = proc.returncode
proc.kill()
self.output.write(out)
self.log.info("Finished executing the Transform script")
hook = TransformScript(input, output, error, log)