exit code 1 with succesfull transfert in batch script

Advertisement

maxfranco
Joined:
Posts:
3
Location:
Florence

exit code 1 with succesfull transfert in batch script

i'm using a batch script to transfer a big file (about 20GB)

this is the command i use in the batch file:

winscp.com soyoustart /log="%winscplog%" /command "put %warc-bkup%" "exit"

this is the report of the log file:

. 2016-06-23 01:27:28.811 Transfer done: '\\cscs3\winarc_bkup\CSCWARC_db_201606220200.BAK' [20925847040]
> 2016-06-23 01:27:29.306 Script: exit
. 2016-06-23 01:27:29.320 Script: Exit code: 1
. 2016-06-23 01:27:29.418 Closing connection.
. 2016-06-23 01:27:29.420 Sending special code: 12
. 2016-06-23 01:27:29.426 Sent EOF message


the resulting errorlevel is ever 1.
what i'm doing wrong? :(

Reply with quote

Advertisement

maxfranco
Joined:
Posts:
3
Location:
Florence

sorry for the delay...
the only command that report a status 1 is the exit command, as showed in the log:

2016-07-11 01:24:00.868 Status code: 0
. 2016-07-11 01:24:00.870 Transfer done: '\\cscs3\winarc_bkup\CSCWARC_db_201607100200.BAK' [20975201792]
> 2016-07-11 01:24:01.240 Script: exit
. 2016-07-11 01:24:01.251 Script: Exit code: 1
. 2016-07-11 01:24:01.435 Closing connection.
. 2016-07-11 01:24:01.436 Sending special code: 12
. 2016-07-11 01:24:01.439 Sent EOF message

can i safely remove the exit command?
but.. why the exit command report an error? all examples i saw used "exit" at the end of the command string.

Reply with quote

maxfranco
Joined:
Posts:
3
Location:
Florence

sorry for the delay..

this is the complete log.
the file is succesfully tansferred, but the exit code is ever 1

. 2017-03-09 15:04:24.557 --------------------------------------------------------------------------
. 2017-03-09 15:04:24.559 WinSCP Versione 5.7.7 (Build 6257) (OS 6.1.7600 - Windows Server 2008 R2 Enterprise)
. 2017-03-09 15:04:24.561 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2017-03-09 15:04:24.563 Log level: Normal
. 2017-03-09 15:04:24.564 Local account: CSC\Administrator
. 2017-03-09 15:04:24.566 Working directory: C:\scripts
. 2017-03-09 15:04:24.568 Process ID: 1992
. 2017-03-09 15:04:24.569 Command-line: "c:\Program Files (x86)\WinSCP\WinSCP.exe" /console=577 /consoleinstance=_1052_135 "sys.vpn" "/log=\\cscs2017\bkup\\log\bkup-remoto-winscp_2017-03-09_15.04.log" "/command" "put \\cscs2017\bkup\\CSCWARC\CSCWARC_backup_2017_03_09_150001_0753590.bak" "exit" 
. 2017-03-09 15:04:24.570 Time zone: Current: GMT+1, Standard: GMT+1 (W. Europe Standard Time), DST: GMT+2 (W. Europe Daylight Time), DST Start: 26/03/2017, DST End: 29/10/2017
. 2017-03-09 15:04:24.572 Login time: giovedì 9 marzo 2017 15:04:24
. 2017-03-09 15:04:24.573 --------------------------------------------------------------------------
. 2017-03-09 15:04:24.575 Script: Retrospectively logging previous script records:
< 2017-03-09 15:04:24.577 Script: Aprire una session usando parametri a riga di comando in uno script è deprecato. Usa invece il comando 'apri'.
. 2017-03-09 15:04:24.578 --------------------------------------------------------------------------
. 2017-03-09 15:04:24.579 Session name: sys.vpn (Site)
. 2017-03-09 15:04:24.581 Host name: 10.8.0.1 (Port: 22)
. 2017-03-09 15:04:24.582 User name: root (Password: No, Key file: Yes)
. 2017-03-09 15:04:24.584 Tunnel: No
. 2017-03-09 15:04:24.585 Transfer Protocol: SFTP (SCP)
. 2017-03-09 15:04:24.586 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2017-03-09 15:04:24.587 Disable Nagle: No
. 2017-03-09 15:04:24.588 Proxy: none
. 2017-03-09 15:04:24.591 Send buffer: 262144
. 2017-03-09 15:04:24.593 SSH protocol version: 2; Compression: No
. 2017-03-09 15:04:24.594 Bypass authentication: No
. 2017-03-09 15:04:24.595 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2017-03-09 15:04:24.597 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2017-03-09 15:04:24.599 KEX: dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN
. 2017-03-09 15:04:24.600 SSH Bugs: A,A,A,A,A,A,A,A,A,A,A,A
. 2017-03-09 15:04:24.602 Simple channel: Yes
. 2017-03-09 15:04:24.604 Return code variable: Autodetect; Lookup user groups: A
. 2017-03-09 15:04:24.606 Shell: default
. 2017-03-09 15:04:24.608 EOL: 0, UTF: 2
. 2017-03-09 15:04:24.609 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2017-03-09 15:04:24.611 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2017-03-09 15:04:24.612 SFTP Bugs: A,A
. 2017-03-09 15:04:24.614 SFTP Server: default
. 2017-03-09 15:04:24.615 Local directory: W:\, Remote directory: /winarc-bkup, Update: No, Cache: Yes
. 2017-03-09 15:04:24.617 Cache directory changes: Yes, Permanent: Yes
. 2017-03-09 15:04:24.618 DST mode: 1
. 2017-03-09 15:04:24.619 --------------------------------------------------------------------------
. 2017-03-09 15:04:24.622 Looking up host "10.8.0.1"
. 2017-03-09 15:04:24.624 Connecting to 10.8.0.1 port 22
. 2017-03-09 15:04:24.702 Server version: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.1
. 2017-03-09 15:04:24.704 Using SSH protocol version 2
. 2017-03-09 15:04:24.706 We claim version: SSH-2.0-WinSCP_release_5.7.7
. 2017-03-09 15:04:24.742 Doing Diffie-Hellman group exchange
. 2017-03-09 15:04:24.864 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-03-09 15:04:27.211 Verifying host key rsa2 0x10001,0xb39463951a7759bb a13b2a0118f3e4d7 65836df49da650b3 253220901912b68a 3e23ca1e10c951b9 912d238ef8e7e849 5ea14d198bfe7c3e 3903c4adc01593c2 e5506130631a76dd c42cc3a95bf448db 0b894172413df8ec eba0785ccb0cfa48 c748d36cd7083535 33f5de934e714f4b f1f5d10e2be84bfa 6392aaafe215dc71 65ca7f0fdab8a733 52c6e88e9e977c23 2ca7be9ffdbe0d58 4e545655438ca4cf bbf16b369f45b7e3 5621cdd7e2535eab 8ce43d26b43f7c4a eb0a0538d4c6e559 3be21ef33f39799a 35e47f31c9ac318f b55b9e38402bfc9a 7b98e3eb281b9cfa 392c87038865932e f56994cac81385ad 9e6a5801d7ec58f3 84d45957cebbf6dd  with fingerprint ssh-rsa 2048 94:53:9c:bc:4e:48:2d:a7:86:4f:4d:c3:33:3c:3d:24
. 2017-03-09 15:04:27.217 Host key matches cached key
. 2017-03-09 15:04:27.218 Host key fingerprint is:
. 2017-03-09 15:04:27.220 ssh-rsa 2048 94:53:9c:bc:4e:48:2d:a7:86:4f:4d:c3:33:3c:3d:24
. 2017-03-09 15:04:27.223 Initialised AES-256 SDCTR client->server encryption
. 2017-03-09 15:04:27.224 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-03-09 15:04:27.226 Initialised AES-256 SDCTR server->client encryption
. 2017-03-09 15:04:27.228 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2017-03-09 15:04:27.326 Reading private key file "C:\scripts\chiaveprivata.ppk"
! 2017-03-09 15:04:27.329 Using username "root".
. 2017-03-09 15:04:27.366 Offered public key
. 2017-03-09 15:04:27.401 Offer of public key accepted
! 2017-03-09 15:04:27.402 Authenticating with public key "rsa-key-20150701"
. 2017-03-09 15:04:27.763 Sent public key signature
. 2017-03-09 15:04:27.797 Access granted
. 2017-03-09 15:04:27.800 Opening session as main channel
. 2017-03-09 15:04:28.153 Opened main channel
. 2017-03-09 15:04:28.221 Started a shell/command
. 2017-03-09 15:04:28.223 --------------------------------------------------------------------------
. 2017-03-09 15:04:28.225 Using SFTP protocol.
. 2017-03-09 15:04:28.227 Doing startup conversation with host.
> 2017-03-09 15:04:28.229 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2017-03-09 15:04:28.265 Type: SSH_FXP_VERSION, Size: 150, Number: -1
. 2017-03-09 15:04:28.267 SFTP version 3 negotiated.
. 2017-03-09 15:04:28.269 Unknown server extension posix-rename@openssh.com="1"
. 2017-03-09 15:04:28.270 Supports statvfs@openssh.com extension version "2"
. 2017-03-09 15:04:28.272 Unknown server extension fstatvfs@openssh.com="2"
. 2017-03-09 15:04:28.274 Supports hardlink@openssh.com extension version "1"
. 2017-03-09 15:04:28.276 Unknown server extension fsync@openssh.com="1"
. 2017-03-09 15:04:28.278 We believe the server has signed timestamps bug
. 2017-03-09 15:04:28.279 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 string are not mandatory
. 2017-03-09 15:04:28.281 Limiting packet size to OpenSSH sftp-server limit of 262148 bytes
. 2017-03-09 15:04:28.282 Changing directory to "/winarc-bkup".
. 2017-03-09 15:04:28.284 Getting real path for '/winarc-bkup'
> 2017-03-09 15:04:28.286 Type: SSH_FXP_REALPATH, Size: 21, Number: 16
< 2017-03-09 15:04:28.321 Type: SSH_FXP_NAME, Size: 45, Number: 16
. 2017-03-09 15:04:28.323 Real path is '/winarc-bkup'
. 2017-03-09 15:04:28.325 Trying to open directory "/winarc-bkup".
> 2017-03-09 15:04:28.326 Type: SSH_FXP_LSTAT, Size: 21, Number: 263
< 2017-03-09 15:04:28.361 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2017-03-09 15:04:28.363 Getting current directory name.
. 2017-03-09 15:04:28.364 Startup conversation with host finished.
< 2017-03-09 15:04:28.367 Script: Errore cambiando cartella su 'W:\'.
< 2017-03-09 15:04:28.370 Script: Errore di Sistema.  Codice: 3.
< 2017-03-09 15:04:28.372 The system cannot find the path specified
< 2017-03-09 15:04:28.374 Script: Sessione attiva: [1] sys.vpn
. 2017-03-09 15:04:28.376 Script: Failed
> 2017-03-09 15:04:28.379 Script: put \\cscs2017\bkup\\CSCWARC\CSCWARC_backup_2017_03_09_150001_0753590.bak
. 2017-03-09 15:04:28.385 Copying 1 files/directories to remote directory "/winarc-bkup"
. 2017-03-09 15:04:28.387   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: No; Mask: 
. 2017-03-09 15:04:28.388   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: ; ResumeL: 0
. 2017-03-09 15:04:28.390   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2017-03-09 15:04:28.398 File: '\\cscs2017\bkup\\CSCWARC\CSCWARC_backup_2017_03_09_150001_0753590.bak' [2017-03-09T14:01:54.515Z] [4859071488]
. 2017-03-09 15:04:28.407 Copying "\\cscs2017\bkup\\CSCWARC\CSCWARC_backup_2017_03_09_150001_0753590.bak" to remote directory started.
. 2017-03-09 15:04:28.409 Binary transfer mode selected.
. 2017-03-09 15:04:28.410 Checking existence of file.
> 2017-03-09 15:04:28.411 Type: SSH_FXP_LSTAT, Size: 66, Number: 519
< 2017-03-09 15:04:28.446 Type: SSH_FXP_STATUS, Size: 29, Number: 519
< 2017-03-09 15:04:28.448 Status code: 2
. 2017-03-09 15:04:28.450 Checking existence of partially transfered file.
> 2017-03-09 15:04:28.451 Type: SSH_FXP_LSTAT, Size: 75, Number: 775
< 2017-03-09 15:04:28.488 Type: SSH_FXP_STATUS, Size: 29, Number: 775
< 2017-03-09 15:04:28.490 Status code: 2
. 2017-03-09 15:04:28.492 Opening remote file.
> 2017-03-09 15:04:28.494 Type: SSH_FXP_OPEN, Size: 91, Number: 1027
< 2017-03-09 15:04:28.529 Type: SSH_FXP_HANDLE, Size: 13, Number: 1027
> 2017-03-09 15:04:28.587 Type: SSH_FXP_WRITE, Size: 4121, Number: 1542
. 2017-03-09 15:21:08.668 Initiating key re-exchange (too much data sent)
. 2017-03-09 15:21:08.987 Doing Diffie-Hellman group exchange
. 2017-03-09 15:21:09.035 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-03-09 15:21:11.550 Initialised AES-256 SDCTR client->server encryption
. 2017-03-09 15:21:11.551 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-03-09 15:21:12.327 Initialised AES-256 SDCTR server->client encryption
. 2017-03-09 15:21:12.338 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2017-03-09 15:36:54.117 Initiating key re-exchange (too much data sent)
. 2017-03-09 15:36:54.352 Doing Diffie-Hellman group exchange
. 2017-03-09 15:36:54.394 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-03-09 15:36:56.683 Initialised AES-256 SDCTR client->server encryption
. 2017-03-09 15:36:56.684 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-03-09 15:36:57.397 Initialised AES-256 SDCTR server->client encryption
. 2017-03-09 15:36:57.404 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2017-03-09 15:53:23.471 Initiating key re-exchange (too much data sent)
. 2017-03-09 15:53:23.709 Doing Diffie-Hellman group exchange
. 2017-03-09 15:53:23.750 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-03-09 15:53:25.979 Initialised AES-256 SDCTR client->server encryption
. 2017-03-09 15:53:25.980 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-03-09 15:53:26.661 Initialised AES-256 SDCTR server->client encryption
. 2017-03-09 15:53:26.666 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2017-03-09 16:08:59.256 Initiating key re-exchange (too much data sent)
. 2017-03-09 16:08:59.491 Doing Diffie-Hellman group exchange
. 2017-03-09 16:08:59.535 Doing Diffie-Hellman key exchange with hash SHA-256
. 2017-03-09 16:09:01.708 Initialised AES-256 SDCTR client->server encryption
. 2017-03-09 16:09:01.710 Initialised HMAC-SHA-256 client->server MAC algorithm
. 2017-03-09 16:09:02.411 Initialised AES-256 SDCTR server->client encryption
. 2017-03-09 16:09:02.419 Initialised HMAC-SHA-256 server->client MAC algorithm
. 2017-03-09 16:18:13.678 296834 skipped SSH_FXP_WRITE, SSH_FXP_READ, SSH_FXP_DATA and SSH_FXP_STATUS packets.
> 2017-03-09 16:18:13.680 Type: SSH_FXP_CLOSE, Size: 13, Number: 37997572
< 2017-03-09 16:18:13.697 Type: SSH_FXP_STATUS, Size: 24, Number: 37995270
< 2017-03-09 16:18:13.729 Type: SSH_FXP_STATUS, Size: 24, Number: 37995526
< 2017-03-09 16:18:13.757 Type: SSH_FXP_STATUS, Size: 24, Number: 37995782
< 2017-03-09 16:18:13.785 Type: SSH_FXP_STATUS, Size: 24, Number: 37996038
< 2017-03-09 16:18:13.816 Type: SSH_FXP_STATUS, Size: 24, Number: 37996294
< 2017-03-09 16:18:13.845 Type: SSH_FXP_STATUS, Size: 24, Number: 37996550
< 2017-03-09 16:18:13.883 Type: SSH_FXP_STATUS, Size: 24, Number: 37996806
< 2017-03-09 16:18:13.906 Type: SSH_FXP_STATUS, Size: 24, Number: 37997062
< 2017-03-09 16:18:13.913 Type: SSH_FXP_STATUS, Size: 24, Number: 37997318
< 2017-03-09 16:18:13.915 Type: SSH_FXP_STATUS, Size: 24, Number: 37997572
< 2017-03-09 16:18:13.916 Status code: 0
> 2017-03-09 16:18:13.918 Type: SSH_FXP_RENAME, Size: 136, Number: 37997842
< 2017-03-09 16:18:13.954 Type: SSH_FXP_STATUS, Size: 24, Number: 37997842
< 2017-03-09 16:18:13.956 Status code: 0
. 2017-03-09 16:18:13.959 Preserving timestamp [2017-03-09T14:01:54.000Z]
> 2017-03-09 16:18:13.961 Type: SSH_FXP_SETSTAT, Size: 78, Number: 1289
< 2017-03-09 16:18:13.996 Type: SSH_FXP_STATUS, Size: 24, Number: 1289
< 2017-03-09 16:18:13.998 Status code: 0
. 2017-03-09 16:18:14.001 Transfer done: '\\cscs2017\bkup\\CSCWARC\CSCWARC_backup_2017_03_09_150001_0753590.bak' [4859071488]
> 2017-03-09 16:18:14.016 Script: exit
. 2017-03-09 16:18:14.019 Script: Exit code: 1
. 2017-03-09 16:18:14.021 Closing connection.
. 2017-03-09 16:18:14.022 Sending special code: 12
. 2017-03-09 16:18:14.023 Sent EOF message

Reply with quote

Advertisement

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

You are opening a stored site that has W:\ set as an initial local directory. That path does not exist.

Fix your stored site to use a valid initial local path.
Or actually, you should not rely on a stored site in scripting:
https://winscp.net/eng/docs/scripting#configuration

Also you should use the open command to open a session.

You should also upgrade to the latest version of WinSCP.

Reply with quote

Guest

Hi Martin
thanks for your help.
I updated winscp to the last version and i'll follow your suggestion and I will use explicit command in a script instead of the stored site I'm using actually.

Just for knowledge, I'm wondering why the w: folder is not recognized: the task skeduler is running this task under the administrator credentials, and w: is mapped under the administrator account.

[/quote]

Reply with quote

Advertisement

You can post new topics in this forum