i have lotus notes agent code which is working fine when we run manually but its not working in scheduled agent my code below:
Sub Initialize
On Error Resume Next
pathName$ = "E:SFTP" 'Pathname should contain the flatfile location fileName$ = Dir$(pathName$, 0)
If fileName$ = "" Then
Messagebox "**There are no files to upload**"
Else
Do While fileName$ <> ""
cmdStr ={C:Program FilesWinSCPwinscp.exe /console /command "option batch on" "open 10.237.6.55:sftp_lncoe@10.237.6.55 -hostkey="ssh-rsa 2048 21:cf:39:96:35:72:2c:97:d1:ff:19:8c:85:50:ed:a2"" "cd /sftp/home/sftp_lncoe/AUAR/" "put E:SFTP"} & fileName$ & { "close" "exit"" }
Msgbox cmdStr retVal=Shell(cmdStr, 3) 'Executing the command line statement
fileName$ = Dir$() 'Looping the all files in the folder 'fileName$ = ""
Messagebox "end while"
Loop
End If
If retVal = 33 Then 'Shell method returns 33 on completing the execution.
Messagebox "You have successful uploaded files to SFTP server(Temporary prompt)"
Else
Messagebox "Failed to upload" & CStr(retVal)
End If
End Sub
Software/Hardware used:
ASKED:
April 24, 2012 10:17 AM
UPDATED:
April 25, 2012 1:25 PM
Hi, Thanks for ur response..
actually its working fine in manual running(i.e., its transfer file to sftp server and show successful msg) but when the agent scheduled its running without any error and shows successful message also but the problem is (file not present in sftp server)..
please help me to solve this..
I m using winSCP software for sftp..
More questions: when running as a scheduled agent, where is the agent running (on the server or on the client)?
Do you have the agent set to “run on behalf of” some ID?
You didn’t answer the question about whether or not Drive E is a mapped drive and if it has security on it, or if there is security needed to run winscp. Does /sftp/home/sftp_lncoe/AUAR have security on it?
Also, as far as your code goes, you’re only checking for success or failure outside of your loop. That means you’re only getting a msg about the last time the shell cmd executes (last file processed). I realize that’s not the current problem, but once you get the execution problem resolved, it could become an issue later.