script file works for one job but not a new job

Advertisement

dms
Joined:
Posts:
3
Location:
North Carolina

script file works for one job but not a new job

I have two different jobs running using the same setup script. The older one is working just fine but the new one is not. I setup the WinScp sessions just alike, only difference of course is login information. I setup to run log and the log is posted below. I also have pasted the script running below. Thanks for any insight. Tad at DMS.

Session name: MOTFTP (Site)
. 2018-06-22 12:41:10.585 Host name: ftp1.gcommerceinc.com (Port: 21)
. 2018-06-22 12:41:10.586 User name: motownauto.com (Password: Yes, Key file: No, Passphrase: No)
. 2018-06-22 12:41:10.586 Transfer Protocol: FTP
. 2018-06-22 12:41:10.586 Ping type: Dummy, Ping interval: 30 sec; Timeout: 420 sec
. 2018-06-22 12:41:10.586 Disable Nagle: No
. 2018-06-22 12:41:10.586 Proxy: None
. 2018-06-22 12:41:10.586 Send buffer: 262144
. 2018-06-22 12:41:10.586 UTF: Auto
. 2018-06-22 12:41:10.586 FTPS: None [Client certificate: No]
. 2018-06-22 12:41:10.586 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2018-06-22 12:41:10.586 Local directory: C:\Altova\Customer\MOT\Working\Outbound, Remote directory: /motownauto.com/Outbound, Update: Yes, Cache: Yes
. 2018-06-22 12:41:10.586 Cache directory changes: Yes, Permanent: Yes
. 2018-06-22 12:41:10.586 Recycle bin: Delete to: No, Overwritten to: No, Bin path:
. 2018-06-22 12:41:10.586 Timezone offset: 0h 0m
Connecting to ftp1.gcommerceinc.com ...
. 2018-06-22 12:41:10.684 Connected with ftp1.gcommerceinc.com. Waiting for welcome message...
< 2018-06-22 12:41:11.159 220 ftp1.gcommerceinc.com X2 WS_FTP Server 7.6.3(16270138)
> 2018-06-22 12:41:11.160 USER motownauto.com
< 2018-06-22 12:41:34.601 331 Enter password
> 2018-06-22 12:41:34.601 PASS *******
< 2018-06-22 12:41:40.488 230 User logged in
> 2018-06-22 12:41:40.488 SYST
< 2018-06-22 12:41:40.553 215 UNIX
> 2018-06-22 12:41:40.554 FEAT
< 2018-06-22 12:41:40.618 211-Extensions supported
< 2018-06-22 12:41:40.618 SIZE
< 2018-06-22 12:41:40.618 XMD5
< 2018-06-22 12:41:40.618 XSHA1
< 2018-06-22 12:41:40.618 XSHA256
< 2018-06-22 12:41:40.618 XSHA512
< 2018-06-22 12:41:40.618 XQUOTA
< 2018-06-22 12:41:40.618 LANG EN, ES, FR, GE
< 2018-06-22 12:41:40.618 MDTM
< 2018-06-22 12:41:40.618 MLST size*;type*;perm*;create*;modify*;
< 2018-06-22 12:41:40.618 REST STREAM
< 2018-06-22 12:41:40.618 TVFS
< 2018-06-22 12:41:40.618 UTF8
< 2018-06-22 12:41:40.618 AUTH SSL;TLS-P;
< 2018-06-22 12:41:40.618 PBSZ
< 2018-06-22 12:41:40.618 PROT C;P;
< 2018-06-22 12:41:40.619 211 end
> 2018-06-22 12:41:40.619 OPTS UTF8 ON
< 2018-06-22 12:41:40.684 200 Command OPTS succeed
. 2018-06-22 12:41:40.685 Connected

Session name: TCPFTPT (Ad-Hoc site)
. 2018-06-22 11:02:44.567 Host name: TCPFTPT (Port: 22)
. 2018-06-22 11:02:44.567 User name: (Password: No, Key file: No, Passphrase: No)
. 2018-06-22 11:02:44.567 Tunnel: No
. 2018-06-22 11:02:44.567 Transfer Protocol: SFTP (SCP)
. 2018-06-22 11:02:44.567 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2018-06-22 11:02:44.567 Disable Nagle: No
. 2018-06-22 11:02:44.568 Proxy: None
. 2018-06-22 11:02:44.568 Send buffer: 262144
. 2018-06-22 11:02:44.568 SSH protocol version: 2; Compression: No
. 2018-06-22 11:02:44.568 Bypass authentication: No

WINSCP /script=C:\\Altova\\Customer\\TCP\\SCRIPT.txt /log=\"C:\\winscp.log\" /loglevel=0
The script is below

OPEN TCPFTPT
LCD C:\Altova\Customer\TCP\Working\Outbound
cd /tricountypande.com/Outbound
Put PO_850_0000002.XML -filemask=PO_850_0000002.XML
Exit

Reply with quote

Advertisement

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

Re: script file works for one job but not a new job

Please attach a full session log file showing the problem (using the latest version of WinSCP).

Reply with quote

dms
Joined:
Posts:
3
Location:
North Carolina

Session is setup for port 21 but not trying that port when accessing the session from script

The session is setup for port 21 standard FTP protocol. When saving the session and using the session name in script, WinSCP is trying to access SFTP and port 22. I am unsure what is causing this issue. Any ideas? Thanks!

> 2018-06-26 09:37:04.504 Script: OPEN TCPFTPT
. 2018-06-26 09:37:04.504 --------------------------------------------------------------------------
. 2018-06-26 09:37:04.504 Session name: TCPFTPT (Ad-Hoc site)
. 2018-06-26 09:37:04.504 Host name: TCPFTPT (Port: 22)
. 2018-06-26 09:37:04.504 User name: (Password: No, Key file: No, Passphrase: No)
. 2018-06-26 09:37:04.504 Tunnel: No
. 2018-06-26 09:37:04.504 Transfer Protocol: SFTP (SCP)

Reply with quote

dms
Joined:
Posts:
3
Location:
North Carolina

log file attached

Martin,
I have attached the log file. I read thru the link you provided. I check the host keys and the site is setup there. The attached file contains multiple transmission open calls.
All worked but the TCPFTPT site. Thanks!

Tad

Reply with quote

Advertisement

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

Re: log file attached

WinSCP does not know any TCPFTPT site. So I'm pretty sure that the FAQ I've linked previously explains the problem:
The connection fails, because your script depends on site, which is not known by the service’s account; or the local account that runs the service does not have a network access.
...
Configure your session completely using open command, using session URL (and raw session settings, if needed), instead of storing site.
  • Good practice is to develop your scripts with configuration isolated from GUI.
  • Alternatively use INI file instead of registry to store the configuration to make sure the site (and/or other settings) can be accessed by all accounts.
Follow the link for more details.
https://winscp.net/eng/docs/faq_scheduler

Reply with quote

marks
Joined:
Posts:
3
Location:
United States

Script can't connect to multiple accounts on the same remote server

I have multiple accounts on the same remote server, and I have to upload some files to one account, then close this account, connect to another one, and upload some other files to a different account, etc.
Script only connects to 1st account, and ignores others:

My script (.bat):
@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="S:\WinSCP.log" /ini=nul ^
  /command ^
    "open ftpes://sipps_beacon_u01:XXXXX@ftps.spectramd.com/" ^
    "lcd S:" ^
    "cd ""/Beacon Christian Community Center/Patient Activation/Reports""" ^
    "put ""BEACON CHRISTIAN COMMUNITY CENTER QA.xlsx""" ^
    "put ""BEACON CHRISTIAN COMMUNITY CENTER Resurvey.xlsx""" ^
    "put ""Beacon PAM participation in SI CARES.xlsx""" ^   
    "close"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success Beacon
) else (
  echo Error
)
# Another account
  /command ^
    "open ftpes://sipps_camelot_u01:XXX@ftps.spectramd.com/" ^
    "lcd S:" ^
    "cd ""/sipps_camelot_u01/Camelot of Staten Island/Patient Activation/Reports""" ^
    "put ""CAMELOT OF STATEN ISLAND QA.xlsx""" ^
    "put ""CAMELOT OF STATEN ISLAND Resurvey.xlsx""" ^
    "put ""Camelot PAM participation in SI CARES.xlsx""" ^
    "close"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%

Reply with quote

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

Re: Script can't connect to multiple accounts on the same remote server

This is wrong:
# Another account
  /command ^
Batch file does not understand /command.
You are missing a call WinSCP.com. Just use the same call as for the previous account:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="S:\WinSCP.log" /ini=nul ^
  /command ^

Reply with quote

marks
Joined:
Posts:
3
Location:
United States

Re: Script can't connect to multiple accounts on the same remote server

This script connects/uploads to first 2 accounts, and stops not connecting to the 3rd account!

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="S:\PAM_Reports\WinSCP_UploadScripts\WinSCP.log" /ini=nul ^
  /command ^
    "open ftpes://sipps.admin_u1:XXXX@ftps.spectramd.com/" ^
    "lcd S:\PAM_Reports" ^
    "cd ""/sipps_camelot_u01/Camelot of Staten Island/Patient Activation/Reports""" ^
    "put ""CAMELOT QA.xlsx""" ^
    "put ""CAMELOT Resurvey.xlsx""" ^
    "put ""Camelot PAM participation.xlsx""" ^
    "exit"
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="S:\PAM_Reports\WinSCP_UploadScripts\WinSCP.log" /ini=nul ^
  /command ^
    "open ftpes://sipps.admin_u1:XXXX@ftps.spectramd.com/" ^
    "lcd S:\PAM_Reports" ^
    "cd ""/sipps_beacon_u01/Beacon Christian Community Center/Patient Activation/Reports""" ^
    "put ""BEACON CHRISTIAN COMMUNITY CENTER QA.xlsx""" ^
    "put ""BEACON CHRISTIAN COMMUNITY CENTER Resurvey.xlsx""" ^
    "put ""Beacon PAM participation in SI CARES.xlsx""" ^  
    "exit"   
# STOPS HERE!   
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="S:\PAM_Reports\WinSCP_UploadScripts\WinSCP.log" /ini=nul ^
  /command ^
    "open ftpes://sipps.admin_u1:XXX@ftps.spectramd.com/" ^
    "lcd S:\PAM_Reports" ^
    "cd ""/sipps_chasi_u1/Community Action of Staten Island/Patient Activation/Reports""" ^
    "put ""CHASI PAM participation in SI CARES.xlsx""" ^
    "put ""COMMUNITY ACTION OF STATEN ISLAND QA.xlsx""" ^
    "put ""COMMUNITY ACTION OF STATEN ISLAND Resurvey.xlsx""" ^
   
   
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum