EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP - run command before get

Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.
#12781
Posted: 03/12/2010 11:58:25
by istvan laki (Basic support level)
Joined: 05/12/2009
Posts: 2

Is it possible to run a custom shell command before download a file using BizCrypto SFTP Receive Location? For example to check somehow if the file is ready for processing?
Alternatively it would be great to test if the file is locked on the server.

I was wondering if I could use the SSH adapter to run a command on the server, but I am not sure how to do it. Is there any suggeston?

Regards,
Istvan
#12783
Posted: 03/12/2010 13:28:04
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

Out-of-the-box SFTP adapter does not support this (SSH shell is not opened at all when SFTP is used).

Current revision of the adapter stops and returns an error if it is unable to download one of the server-side files (if it is locked, for instance). We plan to update this behavior in one of the future BizCrypto builds, so that locked files would not affect download of other files. I assume, this will be a suitable resolution for your problem?

Quote
I was wondering if I could use the SSH adapter to run a command on the server, but I am not sure how to do it. Is there any suggeston?

Yes, running commands on server is the main purpose of the SSH adapter. The command to run can be set via the Command property of the adapter.
#12800
Posted: 03/16/2010 03:46:58
by istvan laki (Basic support level)
Joined: 05/12/2009
Posts: 2

Hi Innokentiy,

Thanks for the reply. I need a solution which is able to detect if the writing operation has been finished on the extract file (the file is not locked during the full writing process, sometime releases the file). If I used the SSH adapter to detect the writing finished, how can I parse the result of the command? What is the schema I will receive back? How should I configure the SSH adapter? e.g. process the stdout? Can you send me a sample, or some hint?

Thanks in adance,
Istvan
#12801
Posted: 03/16/2010 05:27:14
by Ken Ivanov (EldoS Corp.)

If the file is not locked during writing, how would you guess whether the writing has finished?

One of the possible solutions would be to delegate this task to a server-side application, which will check if the file is ready. If implementation of such application is under your control, the easiest thing would be to make this application block until the file is ready for download. The SSH adapter executing this application, in turn, will also block waiting for the command to return. Once the SSH adapter passes the execution flow to the next element of the orchestration, you can be confident that the file is OK.
#12802
Posted: 03/16/2010 10:27:43
by Tamas Szijarto (Basic support level)
Joined: 06/09/2009
Posts: 2

Hi Innokentiy,

I used the SSH adapter, and seems that it runs the command two times. Is it possible, or I made a mistake?

I used a SSH send port (static solicit-response) with the "rm test.log" command. The response is this:

<?xml version="1.0"?>
<tns:SSHExecResponse targetNamespace="http://www.eldos.com/sbb/wsdl/ssh" xmlns:tns="http://www.eldos.com/sbb/wsdl/ssh">
<tns:Responses>
<tns:CommandResponse>
<tns:CommandRequest>
<tns:Command>rm test.log</tns:Command>
<tns:UseStdOut>true</tns:UseStdOut>
<tns:UseStdErr>true</tns:UseStdErr>
<tns:RedirectStdErrToStdOut>false</tns:RedirectStdErrToStdOut>
<tns:Encoding />
</tns:CommandRequest>
<tns:StdOut />
<tns:StdErr />
<tns:ExitStatus>0</tns:ExitStatus>
<tns:ExitSignal />
<tns:ExitMessage />
</tns:CommandResponse>
<tns:CommandResponse>
<tns:CommandRequest>
<tns:Command>rm test.log</tns:Command>
<tns:UseStdOut>true</tns:UseStdOut>
<tns:UseStdErr>true</tns:UseStdErr>
<tns:RedirectStdErrToStdOut>false</tns:RedirectStdErrToStdOut>
<tns:Encoding />
</tns:CommandRequest>
<tns:StdOut>rm: cannot remove `test.log': No such file or directory
</tns:StdOut>
<tns:StdErr />
<tns:ExitStatus>0</tns:ExitStatus>
<tns:ExitSignal />
<tns:ExitMessage />
</tns:CommandResponse>
</tns:Responses>
</tns:SSHExecResponse>

I configured the send port to trace in a file:

[2010.03.16. 15:20] EldoS SSH Adapter: TransmitMessage()
[2010.03.16. 15:20] EldoS SSH Adapter: ProcessMessage()
[2010.03.16. 15:20] EldoS SSH Adapter: TransmitterEndpoint::ProcessMessage() Dynamic adapter is used. Parsing URI...
[2010.03.16. 15:20] AdapterProperties::ParseOutboundLocation() bc-ssh://xxx@xxx.xxx.xx.xx:22/rm test.log
[2010.03.16. 15:20] EldoS SSH Adapter: Parsing URI string failed (it is OK if the properties are passed in a message or in static adapter settings).
[2010.03.16. 15:20] AdapterProperties::LoadFromMessageContext()
[2010.03.16. 15:20] AdapterProperties::LoadFromMessage()
[2010.03.16. 15:20] EldoS SSH Adapter: Authentication succeeded
[2010.03.16. 15:20] EldoS SSH Adapter: WaitResponse(): Receiving data from SSH host.
[2010.03.16. 15:20] EldoS SSH Adapter: BuildResponseMessage()

Thanks in advance,
Tamas
#12804
Posted: 03/16/2010 12:52:07
by Ken Ivanov (EldoS Corp.)

Hmm, and how exactly are you configuring the adapter? Are you setting the properties via the BizTalk administration console or providing them as context properties?
#12810
Posted: 03/17/2010 07:42:56
by Tamas Szijarto (Basic support level)
Joined: 06/09/2009
Posts: 2

Hi,

I used the administration console. I made some screendshot, I'm attaching it in this reply.

Thanks,
Tamas


[ Download ]
#12820
Posted: 03/18/2010 08:34:23
by Ken Ivanov (EldoS Corp.)

Thank you for the details. It appears that the issue really does exist in 7.2.171 build. We can propose you the following workaround for it:

1) With the use of BizTalk administration console, assign some "dummy" command to the Command property of the adapter (e.g. "ls" or "time", whichever is available and not expensive for your server system). This is the command that would be executed twice.

2) Supply the appropriate command as a message to the input of the adapter. The message would have the following format (assuming that the right command is "/bin/do-the-job"):
Code
<ns0:SSHExecRequest xmlns:ns0="http://www.eldos.com/sbb/wsdl/ssh">
<ns0:Requests>
   <ns0:CommandRequest>
     <ns0:Command>/bin/do-the-job</ns0:Command>
   </ns0:CommandRequest>
</ns0:Requests>
</ns0:SSHExecRequest>


Sorry for the inconvenience. This problem will be fixed in future BizCrypto build.
#12920
Posted: 04/02/2010 09:11:45
by Matt Hartman (Standard support level)
Joined: 12/14/2009
Posts: 2

Any updates on this? I would like to be able to be able to kick off an SSH command whenever a certain receive port needs a file... If I have to generate an xml message file then I think I'll need to create an orchestration which I was trying to avoid. I'd much rather have a pure messaging solution.
#12921
Posted: 04/02/2010 22:45:24
by Ken Ivanov (EldoS Corp.)

Sorry for disappointing you, but this task cannot be accomplished without involving an orchestration with currently available BizCrypto version. We actually do have the plans of extending SFTP and FTPS adapters with custom command execution, but I cannot say for sure when it will be available.

BTW, what would be the most convenient way for you to get the output of such command (or your task does not require an output)?
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.

Reply

Statistics

Topic viewed 10544 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!