Consultor Eletrônico



Kbase P54234: Unable to run a batch file on AppServer with 'psftp' commands.
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   21/07/2004
Status: Unverified

SYMPTOM(s):

Unable to run a batch file on AppServer with 'psftp' commands.

'psftp' is a free (MIT-licensed) Win32 Telnet and SSH client.

The batch file runs if executed from DOS or from a 4GL client.

Client side code is similar to:

DEFINE VARIABLE hHandle AS HANDLE NO-UNDO.
DEFINE VARIABLE lLogical AS LOGICAL NO-UNDO.

/* Connect to the AppServer */
CREATE SERVER hHandle.
ASSIGN
lLogical = hHandle:CONNECT("-S 5162 -H yshanshi2000 -N tcp -AppService SalesLab").

IF lLogical THEN
MESSAGE "Connected to AppServer..."
VIEW-AS ALERT-BOX INFO BUTTONS OK.
ELSE
MESSAGE "can not connect to AppServer"
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* Run the remote Procedure on the AppServer */
RUN larry.p ON hHandle NO-ERROR.

/* Test for errors generated by the above RUN statement */
IF ERROR-STATUS:ERROR THEN
MESSAGE "There was an error in running the remote procedure".
ELSE
MESSAGE "The remote procedure ran without errors"
VIEW-AS ALERT-BOX INFO BUTTONS OK.

/* batch.p */

OS-COMMAND "c:\temp\batch.bat".

Where 'batch.bat' a simple DOS batch file that starts a batch session of psftp to execute the commands in some.txt file:


REM This is the file batch.bat
cd C:\temp
psftp <hst.isp.num.ber> -l username -pw password -batch -b c:\TEMP\some.txt
exit

Where 'some.txt' is the file containing the psftp commands to be executed in batch mode that looks similar to:

put c:\localdir\sourcefilename remotedir\targetfilename
quit

CAUSE:

AdminServer is set to Logon as LocalSystem Account.

FIX:

Start the AdminService using another user account other than the default Local System Account.