File Copy using WinSCp fails using Task Manager

Advertisement

Mangala
Joined:
Posts:
2

File Copy using WinSCp fails using Task Manager

I have created a batch script that calls a SSIS Package. I have defined a Execute Process Task that calls WinSCP.exe(5.17.7) to copy a file from SFTP location to my local machine.
Manual execution of batch script works without issues. I have a scheduled job in Task Manager and when I manually run the job in Task Manager, the script works fine and the files get copied to my local system.
But when I schedule the job in Task Manager for execution at 12.15 AM everyday, it fails with Error Code 2:
> 2020-10-08 00:15:15.067 Script: get "ucid.log.2020-10-07" E:\SSIS_ROOT\OCCAS_to_DB\OCCAS_Logs\APSRP8962\
. 2020-10-08 00:15:15.067 Listing file "ucid.log.2020-10-07".
> 2020-10-08 00:15:15.067 Type: SSH_FXP_LSTAT, Size: 109, Number: 43527
< 2020-10-08 00:15:15.069 Type: SSH_FXP_STATUS, Size: 29, Number: 43527
< 2020-10-08 00:15:15.069 Status code: 2, Message: 43527, Server: No such file, Language:  
< 2020-10-08 00:15:15.069 Script: Can't get attributes of file 'ucid.log.2020-10-07'.
< 2020-10-08 00:15:15.069 No such file or directory.
< 2020-10-08 00:15:15.069 Error code: 2
< 2020-10-08 00:15:15.069 Error message from server: No such file
. 2020-10-08 00:15:15.069 Script: Failed
. 2020-10-08 00:15:15.069 Script: Exit code: 1
What could be the reason?The file definitely exists in the SFTP location.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,567
Location:
Prague, Czechia

Re: File Copy using WinSCp fails using Task Manager

Put ls command before the get and post full session log files both to the failing scheduled execution and working manual execution.

Reply with quote

Mangala

The issue is fixed!! Thank you so much. Using ls command, I was able to see that the file was not posed on a timely manner on the SFTP. We adjusted the code to get the file on its available time. Thanks again.

Reply with quote

Advertisement

You can post new topics in this forum