FTP using shell is now failing

We recently moved our infrastructure from 2003 Standalones running 8.5.1 to a partitioned servers running on a virtual host (Server 2008 64 bit) running 8.5.2. At that time our scripts that would create and ftp files using the OS started to fail with a “file not found” error. I think that this is a probably a server 2008 issue but I thought I’d toss it out here to see if anyone had any ideas.

Here is how it works:

Step 1: Build a text file with the ftp commands listed on each line.

Step 2: Run the commands created in the file:

ftpCmd = "command.com /c ftp -s: " & ftpCmdFilePath

ftpTaskID = Shell (ftpCmd,7)

At this point you’re probably guessing that the issue is a change in paths. We had adjusted our code to the new paths and printed them out to the log to be sure that they were right. Also, when I go to the server and run the commands manually they work just fine so I do not believe that there is a security issue. The “File not found” error seems to come at the very beginning when I try to grab the file. If I go out to the server and type in the "command.com… " command prompt just flashes so I can not really see what is going on.

Once again, any help in this would be GREATLY appreciated.

Subject: Re: FTP using shell is now failing

Have you tried cmd instead of command.com?

As in:

ftpCmd = "cmd /c ftp -s: " & ftpCmdFilePath

Subject: new different problem

Thanks so much for your response - I should have thought of that.

It looks like I am getting closer but still no joy. I added a param so that the script would pipe the results of the transfer into a log file. If the transfer is successful I will see a message in this log file saying that all is well.

I can see the log file is created (this wasn’t happening before) but nothing is ever appended to it. So it looks like the script is now opening the jobs file but I do not see it logging in to my ftp server.

Subject: solved

We spent a day figuring this out. I hope it helps someone. This is working on server 2008.

You will need to create two files. If there are dynamic elements to any of this (file names, for example) you can create the files on the fly before executing the ftp. I will keep the pathing simple for demonstration purposes. Make sure that security is set in the agent to allow access to the file system.

File #1 : A windows Command file. This is the code that will execute the other code

**** Command File *****

**** Filename – xfer.cmd *************

ftp -n -i -s:c:\transfer.txt >c:\transferlog.txt <—the results are piped into transferlog.txt

File #2 : This file calls the ftp command line

***** TEXT FILE ******

***** File Name – transfer.txt *******

open [Host]

user XXXXXX <---- note - you must include “user”. Example: user Joe

[password}

bin

mput [path to file]

quit

Here is an example to call the line from LotusScript:

ftpTaskID = Shell(“c:\xfer.cmd”)

Call FTPProcessTimeAllowed(30) <----- This is a timer necessary to keep the agent running until the ftp finishes

Sub FTPProcessTimeAllowed (timeOut As Integer)

Dim Start As Variant

Dim NewMsg As String

Dim LastMsg As String

	

'timeOut is the number of seconds that the system waits for the FTP to complete.

Print "Please wait for " & timeOut & " seconds.  Executing FTP commands in process ..."

Start = Timer  

Do While  Timer < (Start + timeOut)

	NewMsg = " Waiting..." & Int(Start + timeOut - Timer)

	If NewMsg <> LastMsg Then    

		LastMsg = NewMsg

	End If

Loop

End Sub

Subject: One small problem

I did not notice until after I had made my last post that transferlog.txt was not quite right. I expected to get the responses from the ftp server (Successful, Failed, etc). However, for some reason I am seeing the outgoing commands instead. The odd thing is that if I run the cmd file manually from the OS it works just fine. Any ideas?