I have a simple batch process which does SFTP a file to a SFTP server. The batch code for that is here:
option batch abort
option confirm off
open sftp://server -hostkey="ssh-rsa 2048 00:aa:00:aa:dd:11:22:11:22:00:55:66:ee:dd:65:dd"
cd \inbound\
put -transfer=ascii c:\apps\ftpfiles\myfile-2015-07-29.txt
exit
I would like to take the log (success , error) of the task in a separate log file.
I have tried making it like:
@Rem ****************************************
@Rem SFTP
@Rem ****************************************
@Rem Send required log to c:\apps\ftplogs\benftp01.log
@echo *** SFTP Process *** >> c:\apps\ftplogs\benftp01.log
@echo RUN DTTM : 29-07 >> c:\apps\ftplogs\benftp01.log
Rem Create Windows SFTP Script
@echo Starting FTP the PGP file... >> c:\apps\ftplogs\benftp01.log
option batch abort
option confirm off
open sftp://server -hostkey="ssh-rsa 2048 00:aa:00:aa:dd:11:22:11:22:00:55:66:ee:dd:65:dd"
cd \inbound\
put -transfer=ascii c:\apps\ftpfiles\myfile-2015-07-29.txt
exit
@echo *** SFTP End *** >> c:\apps\ftplogs\benftp01.log
Running the above script I have Invalid function as the result. Any clue gurus?
Finally I solved the issue,
so it will be much harder to add the loging options in side of the script when you are using SFTP file transfer and depending on the type of 3rd party client (like OpenSSH or WinScp) that is employed the scripting would have been different. Therefore, you need to force the scheduler to make the log file in the action trigger options. Then you could add an argument there and put this as the argument
/log="c:\apps\ftpLogs\benftp01.log"