Error code 2

Advertisement

endo56
Joined:
Posts:
8

Error code 2

Hi,

I saw a similar topic that was asking about the status/error code 2, but couldn't see an answer.

I'm transferring files using a script, and catching the exit code of the application. The exit code is indicating to me that there was an error, and when I check the logs, the only Status/error code that is not 0, is 2.
. 2010-07-29 18:37:59.866 Copying 1 files/directories to remote directory "/test"
. 2010-07-29 18:37:59.866   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: 
. 2010-07-29 18:37:59.866   TM: M; ClAr: No; CPS: 0; ExclM(No): 
. 2010-07-29 18:37:59.866   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-07-29 18:37:59.866 File: "D:\logs\MktData\20100729\5162318\filename"
. 2010-07-29 18:37:59.882 Copying "D:\logs\MktData\20100729\5162318\filename" to remote directory started.
. 2010-07-29 18:37:59.882 Binary transfer mode selected.
. 2010-07-29 18:37:59.882 Checking existence of file.
> 2010-07-29 18:37:59.882 Type: SSH_FXP_LSTAT, Size: 65, Number: 220679
< 2010-07-29 18:38:02.522 Type: SSH_FXP_STATUS, Size: 29, Number: 220679
< 2010-07-29 18:38:02.522 Status/error code: 2
. 2010-07-29 18:38:02.522 Checking existence of partially transfered file.
> 2010-07-29 18:38:02.522 Type: SSH_FXP_LSTAT, Size: 74, Number: 220935
< 2010-07-29 18:38:02.725 Type: SSH_FXP_STATUS, Size: 29, Number: 220935
< 2010-07-29 18:38:02.725 Status/error code: 2
. 2010-07-29 18:38:02.725 Opening remote file.
> 2010-07-29 18:38:02.725 Type: SSH_FXP_OPEN, Size: 90, Number: 221187
< 2010-07-29 18:38:04.960 Type: SSH_FXP_HANDLE, Size: 13, Number: 221187
> 2010-07-29 18:38:04.960 Type: SSH_FXP_WRITE, Size: 4121, Number: 221702
. 2010-07-29 18:38:04.975 29 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2010-07-29 18:38:04.975 Type: SSH_FXP_CLOSE, Size: 13, Number: 225796
< 2010-07-29 18:38:04.991 Type: SSH_FXP_STATUS, Size: 24, Number: 225286
< 2010-07-29 18:38:04.991 Type: SSH_FXP_STATUS, Size: 24, Number: 225542
< 2010-07-29 18:38:05.147 Type: SSH_FXP_STATUS, Size: 24, Number: 225796
< 2010-07-29 18:38:05.210 Status/error code: 0
> 2010-07-29 18:38:05.210 Type: SSH_FXP_RENAME, Size: 134, Number: 226066
< 2010-07-29 18:38:11.116 Type: SSH_FXP_STATUS, Size: 24, Number: 226066
< 2010-07-29 18:38:11.116 Status/error code: 0
> 2010-07-29 18:38:11.116 Type: SSH_FXP_SETSTAT, Size: 77, Number: 221449
< 2010-07-29 18:38:11.897 Type: SSH_FXP_STATUS, Size: 24, Number: 221449
< 2010-07-29 18:38:11.897 Status/error code: 0
There are lots of these errors in a similar context.

What does the error mean?
Has the file transferred successfully in the end?
Is it possible to get a successful exit code even if this error occurs if it means the file was transferred successfully?

Thanks.

Reply with quote

Advertisement

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

Re: error code 2

The status code here is irrelevant. Log file from the latest version (4.2.8) might provide mode useful information.

Reply with quote

endo56
Joined:
Posts:
8

Thanks for your reply. I'll have to see if I can upgrade.

Could the non-zero exit code be generated by anything else in the log? I'm unclear why it's exiting the application with an error.

Thanks.

Reply with quote

Advertisement

endo56
Joined:
Posts:
8

Hi Martin,

I'm trying 4.2.8 and previously I'd have a non-zero exit code about 1-20% of the time now the exit code is always non-zero.

Could the below lines be the reason?

Thanks.
< 2010-08-11 09:06:04.386 WinSCP: this is end-of-file:0
. 2010-08-11 09:06:04.386 Return code variable "$?" selected.
. 2010-08-11 09:06:04.386 Clearing all aliases.
> 2010-08-11 09:06:04.386 unalias "ls" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:04.495 bash: line 4: unalias: ls: not found
< 2010-08-11 09:06:04.745 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:04.745 unalias "echo" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:04.839 bash: line 5: unalias: echo: not found
< 2010-08-11 09:06:04.980 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:04.980 unalias "pwd" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:05.073 bash: line 6: unalias: pwd: not found
< 2010-08-11 09:06:05.183 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:05.183 unalias "cd" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:05.276 bash: line 7: unalias: cd: not found
< 2010-08-11 09:06:05.401 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:05.401 unalias "groups" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:05.495 bash: line 8: unalias: groups: not found
< 2010-08-11 09:06:05.620 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:05.620 unalias "scp" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:05.714 bash: line 9: unalias: scp: not found
< 2010-08-11 09:06:05.839 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:05.839 unalias "rm" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:05.933 bash: line 10: unalias: rm: not found
< 2010-08-11 09:06:06.183 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:06.183 unalias "mv" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:06.276 bash: line 11: unalias: mv: not found
< 2010-08-11 09:06:06.495 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:06.495 unalias "mkdir" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:06.589 bash: line 12: unalias: mkdir: not found
< 2010-08-11 09:06:06.714 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:06.714 unalias "chmod" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:06.808 bash: line 13: unalias: chmod: not found
< 2010-08-11 09:06:06.933 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:06.933 unalias "chgrp" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:07.042 bash: line 14: unalias: chgrp: not found
< 2010-08-11 09:06:07.261 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:07.261 unalias "chown" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:07.354 bash: line 15: unalias: chown: not found
< 2010-08-11 09:06:07.604 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:07.604 unalias "unset" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:07.698 bash: line 16: unalias: unset: not found
< 2010-08-11 09:06:07.917 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:07.917 unalias "unalias" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:08.011 bash: line 17: unalias: unalias: not found
< 2010-08-11 09:06:08.151 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:08.151 unalias "ln" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:08.245 bash: line 18: unalias: ln: not found
< 2010-08-11 09:06:08.479 WinSCP: this is end-of-file:1
> 2010-08-11 09:06:08.479 unalias "cp" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:06:08.573 bash: line 19: unalias: cp: not found

Reply with quote

endo56
Joined:
Posts:
8

Here it is. I've x'ed out the server/key/ip address/users.
Thanks
. 2010-08-11 09:04:35.808 --------------------------------------------------------------------------
. 2010-08-11 09:04:35.808 WinSCP Version 4.2.8 (Build 818) (OS 5.2.3790 Service Pack 2)
. 2010-08-11 09:04:35.808 Login time: 11 August 2010 09:04:35
. 2010-08-11 09:04:35.808 --------------------------------------------------------------------------
. 2010-08-11 09:04:35.808 Session name: xxxxxxxxxxx
. 2010-08-11 09:04:35.808 Host name: xxxxxxxxxxxxxx (Port: 22)
. 2010-08-11 09:04:35.808 User name: xxxxxxxx (Password: Yes, Key file: No)
. 2010-08-11 09:04:35.808 Tunnel: No
. 2010-08-11 09:04:35.808 Transfer Protocol: SCP
. 2010-08-11 09:04:35.808 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2010-08-11 09:04:35.808 Proxy: none
. 2010-08-11 09:04:35.808 SSH protocol version: 2; Compression: No
. 2010-08-11 09:04:35.808 Bypass authentication: No
. 2010-08-11 09:04:35.808 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2010-08-11 09:04:35.808 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2010-08-11 09:04:35.808 SSH Bugs: -,-,-,-,-,-,-,-,-
. 2010-08-11 09:04:35.808 SFTP Bugs: -,-
. 2010-08-11 09:04:35.808 Return code variable: Autodetect; Lookup user groups: Yes
. 2010-08-11 09:04:35.808 Shell: default
. 2010-08-11 09:04:35.808 EOL: 0, UTF: 2
. 2010-08-11 09:04:35.808 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2010-08-11 09:04:35.808 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2010-08-11 09:04:35.808 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2010-08-11 09:04:35.808 Cache directory changes: Yes, Permanent: Yes
. 2010-08-11 09:04:35.808 DST mode: 1
. 2010-08-11 09:04:35.808 --------------------------------------------------------------------------
. 2010-08-11 09:04:35.808 Looking up host "xxxxxxxxxxxxxxxxx"
. 2010-08-11 09:04:35.808 Connecting to 10.1.1.4 port 22
. 2010-08-11 09:04:35.823 Server version: SSH-2.0-Sun_SSH_1.1.1
. 2010-08-11 09:04:35.823 We believe remote version has SSH-2 ignore bug
. 2010-08-11 09:04:35.823 Using SSH protocol version 2
. 2010-08-11 09:04:35.823 We claim version: SSH-2.0-WinSCP_release_4.2.8
. 2010-08-11 09:04:35.855 Doing Diffie-Hellman group exchange
. 2010-08-11 09:04:35.855 Doing Diffie-Hellman key exchange with hash SHA-1
. 2010-08-11 09:04:35.902 Host key fingerprint is:
. 2010-08-11 09:04:35.902 ssh-rsa 1024 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
. 2010-08-11 09:04:35.902 Initialised AES-128 SDCTR client->server encryption
. 2010-08-11 09:04:35.902 Initialised HMAC-SHA1 client->server MAC algorithm
. 2010-08-11 09:04:35.902 Initialised AES-128 SDCTR server->client encryption
. 2010-08-11 09:04:35.902 Initialised HMAC-SHA1 server->client MAC algorithm
! 2010-08-11 09:04:35.948 Using username "xxxxxxxxxxxx".
. 2010-08-11 09:04:35.980 Prompt (5, SSH server authentication, Using keyboard-interactive authentication., Password: )
. 2010-08-11 09:04:35.980 Using stored password.
. 2010-08-11 09:04:36.058 Access granted
. 2010-08-11 09:04:36.089 Opened channel for session
. 2010-08-11 09:04:36.152 Started a shell/command
. 2010-08-11 09:04:36.152 --------------------------------------------------------------------------
. 2010-08-11 09:04:36.152 Using SCP protocol.
. 2010-08-11 09:04:36.152 Doing startup conversation with host.
. 2010-08-11 09:04:36.152 Skipping host startup message (if any).
> 2010-08-11 09:04:36.152 echo "WinSCP: this is end-of-file:0"
< 2010-08-11 09:04:36.245 Access to this computer is prohibited unless authorised
< 2010-08-11 09:04:36.245 Accessing programs or data unrelated to your job is prohibited
< 2010-08-11 09:04:36.245 If you are not authorised, disconnect now.
< 2010-08-11 09:04:36.245 This server is supported by IES UNIX Support Group:
< 2010-08-11 09:04:36.245 For IES ES support group contact details please refer to:
< 2010-08-11 09:04:36.245 For server information details please search for server 'hostname' in the GTO
< 2010-08-11 09:04:36.245 Asset Centre system:
< 2010-08-11 09:04:36.245 Where the Asset Centre 'HCL Access' field value equals 'Yes - In Scope',  the
< 2010-08-11 09:04:36.245 server is then subject to  24 x 7  first level direct support by HCL Comnet,
< 2010-08-11 09:04:36.245 who's contact details are available at:
< 2010-08-11 09:04:36.245 You have new mail.
< 2010-08-11 09:04:36.480 Hello hoandre
< 2010-08-11 09:04:36.480 WinSCP: this is end-of-file:0
. 2010-08-11 09:04:36.480 Detecting variable containing return code of last command.
. 2010-08-11 09:04:36.480 Trying "$status".
> 2010-08-11 09:04:36.480 echo "$status" ; echo "WinSCP: this is end-of-file:0"
< 2010-08-11 09:04:36.808 WinSCP: this is end-of-file:0
. 2010-08-11 09:04:36.808 The response is not numerical exit code
. 2010-08-11 09:04:36.808 Trying "$?".
> 2010-08-11 09:04:36.808 echo "$?" ; echo "WinSCP: this is end-of-file:0"
< 2010-08-11 09:04:36.902 0
< 2010-08-11 09:04:37.136 WinSCP: this is end-of-file:0
. 2010-08-11 09:04:37.136 Return code variable "$?" selected.
. 2010-08-11 09:04:37.136 Clearing all aliases.
> 2010-08-11 09:04:37.136 unalias "ls" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:37.230 bash: line 4: unalias: ls: not found
< 2010-08-11 09:04:37.448 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:37.448 unalias "echo" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:37.542 bash: line 5: unalias: echo: not found
< 2010-08-11 09:04:37.667 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:37.667 unalias "pwd" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:37.761 bash: line 6: unalias: pwd: not found
< 2010-08-11 09:04:37.777 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:37.777 unalias "cd" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:37.870 bash: line 7: unalias: cd: not found
< 2010-08-11 09:04:37.995 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:37.995 unalias "groups" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:38.089 bash: line 8: unalias: groups: not found
< 2010-08-11 09:04:38.214 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:38.214 unalias "scp" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:38.308 bash: line 9: unalias: scp: not found
< 2010-08-11 09:04:38.433 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:38.433 unalias "rm" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:38.526 bash: line 10: unalias: rm: not found
< 2010-08-11 09:04:38.761 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:38.761 unalias "mv" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:38.855 bash: line 11: unalias: mv: not found
< 2010-08-11 09:04:38.870 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:38.870 unalias "mkdir" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:38.948 bash: line 12: unalias: mkdir: not found
< 2010-08-11 09:04:39.105 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:39.105 unalias "chmod" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:39.198 bash: line 13: unalias: chmod: not found
< 2010-08-11 09:04:39.526 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:39.526 unalias "chgrp" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:39.620 bash: line 14: unalias: chgrp: not found
< 2010-08-11 09:04:39.855 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:39.855 unalias "chown" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:39.948 bash: line 15: unalias: chown: not found
< 2010-08-11 09:04:40.183 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:40.183 unalias "unset" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:40.276 bash: line 16: unalias: unset: not found
< 2010-08-11 09:04:40.417 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:40.448 unalias "unalias" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:40.542 bash: line 17: unalias: unalias: not found
< 2010-08-11 09:04:40.745 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:40.745 unalias "ln" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:40.839 bash: line 18: unalias: ln: not found
< 2010-08-11 09:04:41.073 WinSCP: this is end-of-file:1
> 2010-08-11 09:04:41.073 unalias "cp" ; echo "WinSCP: this is end-of-file:$?"
! 2010-08-11 09:04:41.167 bash: line 19: unalias: cp: not found
< 2010-08-11 09:04:41.276 WinSCP: this is end-of-file:1
. 2010-08-11 09:04:41.276 Clearing national user variables.
> 2010-08-11 09:04:41.276 unset "LANG" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.386 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.386 unset "LANGUAGE" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.479 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.479 unset "LC_CTYPE" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.573 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.573 unset "LC_COLLATE" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.667 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.667 unset "LC_MONETARY" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.776 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.776 unset "LC_NUMERIC" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.870 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.870 unset "LC_TIME" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:41.979 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:41.979 unset "LC_MESSAGES" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.073 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:42.073 unset "LC_ALL" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.167 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:42.167 unset "HUMAN_BLOCKS" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.276 WinSCP: this is end-of-file:0
. 2010-08-11 09:04:42.276 Looking up groups and users.
> 2010-08-11 09:04:42.276 groups ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.401 gswpoper ratejira gswptrad grmuatlx
< 2010-08-11 09:04:42.589 WinSCP: this is end-of-file:0
. 2010-08-11 09:04:42.589 Following groups found:
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589 Following membership found:
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589 Following users found:
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589   "xxxxxx" [0]
. 2010-08-11 09:04:42.589 Getting current directory name.
> 2010-08-11 09:04:42.589 pwd ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.698 /home/grimis
< 2010-08-11 09:04:42.698 WinSCP: this is end-of-file:0
. 2010-08-11 09:04:42.698 Startup conversation with host finished.
< 2010-08-11 09:04:42.698 Script: Active session: [1] xxxxxxxxx@xxxxxxxxxxxxxxxxx
> 2010-08-11 09:04:42.698 Script: cd /applogs/sdos/intraday/mktdata/
. 2010-08-11 09:04:42.698 Cached directory change via "/applogs/sdos/intraday/mktdata/" to "/applogs/sdos/intraday/mktdata".
. 2010-08-11 09:04:42.698 Getting current directory name.
< 2010-08-11 09:04:42.698 Script: /applogs/sdos/intraday/mktdata
> 2010-08-11 09:04:42.698 Script: put "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\TwoSidedDelta"
. 2010-08-11 09:04:42.698 Copying 1 files/directories to remote directory "/applogs/sdos/intraday/mktdata"
. 2010-08-11 09:04:42.698   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: 
. 2010-08-11 09:04:42.698   TM: M; ClAr: No; CPS: 0; ExclM(No): 
. 2010-08-11 09:04:42.698   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2010-08-11 09:04:42.698 Locating to cached directory "/applogs/sdos/intraday/mktdata".
> 2010-08-11 09:04:42.698 cd "/applogs/sdos/intraday/mktdata" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.792 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:42.823 echo "WinSCP: this is begin-of-file" ; scp -r  -d -t "/applogs/sdos/intraday/mktdata" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:42.901 WinSCP: this is begin-of-file
. 2010-08-11 09:04:43.026 SCP remote side confirmation (0)
. 2010-08-11 09:04:43.026 File: "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\TwoSidedDelta"
. 2010-08-11 09:04:43.026 Copying "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\TwoSidedDelta" to remote directory started.
. 2010-08-11 09:04:43.026 Binary transfer mode selected.
> 2010-08-11 09:04:43.026 T1281510248 0 1281510248 0
. 2010-08-11 09:04:43.120 SCP remote side confirmation (0)
> 2010-08-11 09:04:43.120 C0644 650 TwoSidedDelta
. 2010-08-11 09:04:43.229 SCP remote side confirmation (0)
. 2010-08-11 09:04:43.229 Sending BINARY data (first block, 650 bytes)
. 2010-08-11 09:04:43.229 Sending NULL.
. 2010-08-11 09:04:43.339 SCP remote side confirmation (0)
. 2010-08-11 09:04:43.339 Copying "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\TwoSidedDelta" to remote directory finished.
> 2010-08-11 09:04:43.339 E
. 2010-08-11 09:04:43.417 SCP remote side confirmation (0)
< 2010-08-11 09:04:43.589 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:43.589 Script: put "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\DividendDelta"
. 2010-08-11 09:04:43.589 Copying 1 files/directories to remote directory "/applogs/sdos/intraday/mktdata"
. 2010-08-11 09:04:43.589   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 01; Resume: S (102400); CalcS: No; Mask: 
. 2010-08-11 09:04:43.589   TM: M; ClAr: No; CPS: 0; ExclM(No): 
. 2010-08-11 09:04:43.589   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
> 2010-08-11 09:04:43.589 echo "WinSCP: this is begin-of-file" ; scp -r  -d -t "/applogs/sdos/intraday/mktdata" ; echo "WinSCP: this is end-of-file:$?"
< 2010-08-11 09:04:43.682 WinSCP: this is begin-of-file
. 2010-08-11 09:04:43.917 SCP remote side confirmation (0)
. 2010-08-11 09:04:43.917 File: "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\DividendDelta"
. 2010-08-11 09:04:43.917 Copying "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\DividendDelta" to remote directory started.
. 2010-08-11 09:04:43.917 Binary transfer mode selected.
> 2010-08-11 09:04:43.917 T1281510248 0 1281510248 0
. 2010-08-11 09:04:44.011 SCP remote side confirmation (0)
> 2010-08-11 09:04:44.011 C0644 417 DividendDelta
. 2010-08-11 09:04:44.120 SCP remote side confirmation (0)
. 2010-08-11 09:04:44.120 Sending BINARY data (first block, 417 bytes)
. 2010-08-11 09:04:44.120 Sending NULL.
. 2010-08-11 09:04:44.229 SCP remote side confirmation (0)
. 2010-08-11 09:04:44.229 Copying "D:\logs\RiskEngine\MktData\20100811\2470873\A3473~TGOTC~GOS\DividendDelta" to remote directory finished.
> 2010-08-11 09:04:44.229 E
. 2010-08-11 09:04:44.339 SCP remote side confirmation (0)
< 2010-08-11 09:04:44.573 WinSCP: this is end-of-file:0
> 2010-08-11 09:04:44.573 Script: close
. 2010-08-11 09:04:44.573 Closing connection.
. 2010-08-11 09:04:44.573 Sending special code: 12
. 2010-08-11 09:04:44.573 Sent EOF message

Reply with quote

martin
Site Admin
martin avatar

There's nothing justifying the non-zero exit code. Can you show how do you run WinSCP and how do you check for its exit code?

Reply with quote

Advertisement

endo56
Joined:
Posts:
8

Hi Martin, thanks for looking.

Everything is done in VBA.

I create a script with a set of files to send.

e.g.
option batch on
option confirm off
open user@host -Hostkey="ssh-rsa 1024 xx:xx:xx:xx:xx"
cd /xxxxx/xxxxx/xxxxxxxxx/xxxx/
put "D:\logs\xxxxxx\MktData\20100813\5258851\filename"
close
exit
This is the module that executes the process:
Private Type STARTUPINFO
   cb As Long
   lpReserved As String
   lpDesktop As String
   lpTitle As String
   dwX As Long
   dwY As Long
   dwXSize As Long
   dwYSize As Long
   dwXCountChars As Long
   dwYCountChars As Long
   dwFillAttribute As Long
   dwFlags As Long
   wShowWindow As Integer
   cbReserved2 As Integer
   lpReserved2 As Long
   hStdInput As Long
   hStdOutput As Long
   hStdError As Long
End Type
 
Private Type PROCESS_INFORMATION
   hProcess As Long
   hThread As Long
   dwProcessID As Long
   dwThreadID As Long
End Type
 
Private Declare Function WaitForSingleObject Lib "kernel32" (ByVal _
   hHandle As Long, ByVal dwMilliseconds As Long) As Long
 
Private Declare Function CreateProcessA Lib "kernel32" (ByVal _
   lpApplicationName As String, ByVal lpCommandLine As String, ByVal _
   lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _
   ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _
   ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As String, _
   lpStartupInfo As STARTUPINFO, lpProcessInformation As _
   PROCESS_INFORMATION) As Long
 
Private Declare Function CloseHandle Lib "kernel32" _
   (ByVal hObject As Long) As Long
 
Private Declare Function GetExitCodeProcess Lib "kernel32" _
   (ByVal hProcess As Long, lpExitCode As Long) As Long
 
Private Const NORMAL_PRIORITY_CLASS = &H20&
Private Const INFINITE = -1&
 
Public Function ExecCmd(cmdline$)
   Dim proc As PROCESS_INFORMATION
   Dim start As STARTUPINFO
 
   ' Initialize the STARTUPINFO structure:
   start.cb = Len(start)
 
   ' Start the shelled application:
   ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
      NORMAL_PRIORITY_CLASS, 0&, vbNullString, start, proc)
 
   ' Wait for the shelled application to finish:
      ret& = WaitForSingleObject(proc.hProcess, INFINITE)
      Call GetExitCodeProcess(proc.hProcess, ret&)
      Call CloseHandle(proc.hThread)
      Call CloseHandle(proc.hProcess)
      ExecCmd = ret&
End Function
This is how the process is called:
retVal = ExecCmd("winscp419.com" & " /script=""" & outputFile & """ /ini=" & Range("UploadIni") & " /log=""" & logFile & """")
I then check that retVal = 0 to declare it a "successful" transfer.

This works quite well with 4.1.9. Except for cases where I get !0 exit code without understanding why (my first post). With 4.2.8 I get 100% !0 exit code.

Thanks for your help.

Reply with quote

martin
Site Admin
martin avatar

Well, there's a known bug with "close" command in 4.2.8 that may cause your problem. Strange is that I do not see any evidence for that in the log file. Anyway, can you try 4.2.7?

Reply with quote

endo56
Joined:
Posts:
8

Hi Martin,

4.2.7 is working better, I'm not seeing the 100% !0 I had with 4.2.8.

The three !0 errors I've had so far are also explained in the logs. This particular error I had never seen in 4.1.9:
< 2010-08-16 09:36:32.236 Status code: 4, Message: 26898, Server: Failure, Language:  
* 2010-08-16 09:36:32.236 (ETerminal) General failure (server should provide error description).
* 2010-08-16 09:36:32.236 Error code: 4
* 2010-08-16 09:36:32.236 Error message from server: Failure
* 2010-08-16 09:36:32.236 Request code: 18
. 2010-08-16 09:36:32.236 Asking user:
. 2010-08-16 09:36:32.236 Transfer was succesfully finished, but temporary transfer file 'xxxxx.filepart' could not be renamed to target file name 'xxxxx'. If the problem persists, you may try to turn off transfer resume support. ("General failure (server should provide error description).
. 2010-08-16 09:36:32.236 Error code: 4
. 2010-08-16 09:36:32.236 Error message from server: Failure
. 2010-08-16 09:36:32.236 Request code: 18")
* 2010-08-16 09:36:32.251 (EScpSkipFile) Transfer was succesfully finished, but temporary transfer file 'xxxxx.filepart' could not be renamed to target file name 'xxxxx'. If the problem persists, you may try to turn off transfer resume support.
* 2010-08-16 09:36:32.251 General failure (server should provide error description).
* 2010-08-16 09:36:32.251 Error code: 4
* 2010-08-16 09:36:32.251 Error message from server: Failure
* 2010-08-16 09:36:32.251 Request code: 18
I don't particularly need resume functionality as this is a fully automated process and any !0 exit code is considered a failure and the job is retried automatically.

If a transfer was halted and WinSCP successfully recovered and resumed the transfer would that still result in a !0 exit code?

If yes, how can I turn off the resume functionality?

Thanks.

Reply with quote

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

endo56 wrote:

If a transfer was halted and WinSCP successfully recovered and resumed the transfer would that still result in a !0 exit code?
What does it mean "halted"? If connection is lost, WinSCP reconnects and restarts transfer (resumes if possible and allowed). If it finishes successfully at the end, exit code is 0.

If yes, how can I turn off the resume functionality?
Please read Transfer was successfully finished, but temporary transfer file … could not be renamed to target file name …. If that does not help, come back.

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum