Runs different Script File that it looks at.

Advertisement

PS8822
Joined:
Posts:
1
Location:
FL

Runs different Script File that it looks at.

Hi,
Not really sure how to explain this well, but going to try.

Using cmd to run txt file to connect to amz SFTP storage and put one file each day.
CMD -
"C:\Program Files (x86)\WinSCP\winscp.com/log= c:\scripts\amz\log_put.log /script=c:\scripts\amz\amz_put.txt
Txt -
open sftp://storage_account/ -hostkey="ssh-rsa 2048 magic_key=" -privatekey="C:\Scripts\key\super_secert.key" -passphrase="hocus pocus" -rawsettings ProxyPort=0
 
# Your command 1
Put "\\my_local_file_share\folder1\Folder_export\*.csv"
# Your command 2
pause 10
exit
The task is ran by Windows Task Scheduler, when running it seems to work. Only recently has there been an issue. So, I put the log command into the cmd.
I noticed something off, it connects fine and does authenticates and all that fun part. The issue is that on the log file it runs a different script than what is in the txt file to run.
I place ***** at the start of the line that seems to be the issue to me at least. That is not what it should be looking for or trying to run. It should be looking in another dir and looking for csv files not json.
Here is the quick grab from the bottom of the log file. I removed the connection info from log file.
********> 2022-06-23 14:58:49.286 Script: Put \\my_local_file_share\folder_beta\Amx\*.json
********< 2022-06-23 14:58:49.286 Script: No file matching '*.json' found. 
Here is the connection and what it thinks/should be looking for (at the top of the log file)
. 2022-06-23 14:58:46.198 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.19.3 /consoleinstance=_9588_914 "/log=c:\Scripts\amz\log_put.log" "/script=c:\scripts\amz\amz_put.txt"
Thoughts as to why it is trying to run this other script / txt file?
. 2022-06-23 14:58:46.198 --------------------------------------------------------------------------
. 2022-06-23 14:58:46.198 WinSCP Version 5.19.3 (Build 11749) (OS 6.1.7601 Service Pack 1 - Windows Server 2008 R2 Standard)
. 2022-06-23 14:58:46.198 Configuration: HKCU\Software\WinSCP 2\
. 2022-06-23 14:58:46.198 Log level: Normal
. 2022-06-23 14:58:46.198 Local account: elf
. 2022-06-23 14:58:46.198 Working directory: C:\Windows\system32
. 2022-06-23 14:58:46.198 Process ID: 7068
. 2022-06-23 14:58:46.198 Ancestor processes: WinSCP, ...
. 2022-06-23 14:58:46.198 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" /console=5.19.3 /consoleinstance=_9588_914 "/log=c:\Scripts\amz\log_put.log" "/script=c:\scripts\amz\amz_put.txt" 
. 2022-06-23 14:58:46.198 Time zone: Current: GMT-4, Standard: GMT-5 (Eastern Standard Time), DST: GMT-4 (Eastern Daylight Time), DST Start: 3/13/2022, DST End: 11/6/2022
. 2022-06-23 14:58:46.198 Login time: Thursday, June 23, 2022 2:58:46 PM
. 2022-06-23 14:58:46.198 --------------------------------------------------------------------------
 
. 2022-06-23 14:58:47.820 --------------------------------------------------------------------------
. 2022-06-23 14:58:47.820 Using SFTP protocol.
. 2022-06-23 14:58:47.820 Doing startup conversation with host.
< 2022-06-23 14:58:47.820 Script: Starting the session...
> 2022-06-23 14:58:47.820 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2022-06-23 14:58:49.255 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2022-06-23 14:58:49.255 SFTP version 3 negotiated.
. 2022-06-23 14:58:49.255 We believe the server has signed timestamps bug
. 2022-06-23 14:58:49.255 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2022-06-23 14:58:49.255 Getting current directory name.
. 2022-06-23 14:58:49.255 Getting real path for '.'
> 2022-06-23 14:58:49.255 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2022-06-23 14:58:49.286 Type: SSH_FXP_NAME, Size: 22, Number: 16
. 2022-06-23 14:58:49.286 Real path is '/'
. 2022-06-23 14:58:49.286 Startup conversation with host finished.
< 2022-06-23 14:58:49.286 Script: Session started.
< 2022-06-23 14:58:49.286 Script: Active session: [1] magic connection
********> 2022-06-23 14:58:49.286 Script: Put \\my_local_file_share\folder_beta\Amx\*.json
********< 2022-06-23 14:58:49.286 Script: No file matching '*.json' found.
. 2022-06-23 14:58:49.286 Copying 0 files/directories to remote directory "/" - total size: 0
. 2022-06-23 14:58:49.286   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2022-06-23 14:58:49.286   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2022-06-23 14:58:49.286   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2022-06-23 14:58:49.286 Copying finished: Transferred: 0, Elapsed: 0:00:00, CPS: 0/s
> 2022-06-23 14:58:49.286 Script: exit
. 2022-06-23 14:58:49.286 Script: Exit code: 0
. 2022-06-23 14:58:49.286 Closing connection.
. 2022-06-23 14:58:49.286 Sending special code: 1
. 2022-06-23 14:58:49.520 Session sent command exit status 0
. 2022-06-23 14:58:49.520 Main session channel closed
. 2022-06-23 14:58:49.520 All channels closed

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,276
Location:
Prague, Czechia

Re: Runs different Script File that it looks at.

WinSCP does no magic, it runs what it gets. So if it runs Put \\my_local_file_share\folder_beta\Amx\*.json, it's because that command is the the script file it got.
Add type c:\scripts\amz\amz_put.txt > c:\scripts\amz\script_put.log to your batch file, before you run WinSCP and check what you get in script_put.log when the batch file runs in the Task Scheduler(!).

Reply with quote

Advertisement

You can post new topics in this forum